title: Double for loop to check dynamic number of plots in shiny app
body: <p>I find myself faced with a problem:</p>
  <p>I already have my shiny application (server part) like this :</p>
  <pre><code>observe({
        data &lt;- my_function() %&gt;%
         filter(col1 == &quot;X1&quot;)
  
  h &lt;- sort(unique(data$year))
  
  nb &lt;- length(h)
  lst &lt;- as.list(h)
  
  output$plot_name &lt;- renderUI({
    plot_output &lt;- lapply(1:nb,
                                   function(n1) {
                                     plotname &lt;- paste0(&quot;plots&quot;, n1)
                                     plotOutput(plotname)
                                   })
    do.call(tagList, plot_output)
  })
  
  my_data &lt;- list()
  
  i &lt;- 0
  for (i in 1:length(lst)) {
    
    local({
      my_i &lt;- i
      plotname &lt;- paste0(&quot;plots&quot;, my_i)
      my_data[[my_i]] &lt;- data %&gt;% 
        filter(year == lst[[my_i]])
      
      output[[plotname]] &lt;- renderPlot({
        
        g &lt;- ggplot(..........)
        
        print(g)
        
      })
      
    })
  }
  </code></pre>
  <p>})</p>
  <p>that allows me to output, for each year, graphs for a given X.</p>
  <p>However I would like to remove the filter and have for each year of each X a graph, knowing that I do not have the same number of years for all X (X1: 2000, X2: 2000 and 2001, X3 : 2001 etc.....).</p>
  <p>Since I would like to determine dynamically the number of graphs.</p>
  <p>If you have any clues, it will be very useful.</p>
  <p>Thanks in advance.</p>