title: Error converting an object list to tag list with dynamic UI in shiny
body: <p>I'm using Shiny's renerUI to create UI objects on the fly following instruction from <a href="https://stackoverflow.com/questions/15875786/dynamically-add-plots-to-web-page-using-shiny">this</a> question.</p>
  
  <p>i'm getting the following error</p>
  
  <pre><code>Error in if (!grepl(pattern, text)) return(text) : 
    argument is of length zero
  </code></pre>
  
  <p>after reading <a href="https://groups.google.com/forum/?fromgroups#!topic/shiny-discuss/8U-42zNvy2Y" rel="nofollow noreferrer">this</a> i know the problem is this line </p>
  
  <pre><code># Convert the list to a tagList
  do.call(tagList, plot_output_list)
  </code></pre>
  
  <p>but i'm doing exactly what the solution suggested. 
  appreciate any help.</p>
  
  <p>the code </p>
  
  <p><strong>Server.r</strong></p>
  
  <pre><code>shinyServer(function(input, output) {
  
      # Create an environment for storing data
      symbol_env &lt;- new.env()
  
      output$plots &lt;- renderUI({
  
          if (input$goButton == 0) 
              return()
  
          if (loaded_index != input$chosen_index) {
  
              # ... alot of code to generate data.frames and plots 
  
              output[["summary"]] &lt;- renderPlot(grid.arrange(g1,g2,g3,g4,g5,nrow=1))
  
              for (i in 1:length(results)) {
                  # Need local so that each item gets its own number. Without it, the value
                  # of i in the renderPlot() will be the same across all instances, because
                  # of when the expression is evaluated.
                  local({
                      my_i &lt;- i
                      plotname &lt;- object_name("plot", names(results[my_i]))
                          output[[plotname]] &lt;- renderPlot({
                              showme_plot(results[[names(results[my_i])]]$data , period = DEFAULT_TIME_PERIOD)})
  
                      tablename &lt;- object_name("table", names(results[my_i]))
                          output[[tablename]] &lt;- renderTable({
                              make_summary(names(results[my_i]))})
                      })
              }
          }
  
          plot_output_list &lt;- list()
  
          # Graphical Summary     
          plot_output_list[["summary"]] &lt;- tags$div(class="summary" , plotOutput("summary")) 
  
          # The List
          for (symbol in names(results))
              plot_output_list[[symbol]] &lt;- 
                  tags$div(class = "container" ,
                      tags$div(class = "name"  , name(symbol)),
                      tags$div(class = "stats" , tableOutput(object_name("table", symbol))) , 
                      tags$div(class = "plot"  , plotOutput(object_name("plot", symbol), height = 530)))
  
          print("Plot structure defined")
  
          # Convert the list to a tagList
          do.call(tagList, plot_output_list)
      })
  })
  </code></pre>
  
  <p><strong>ui.r</strong></p>
  
  <pre><code>require(shinyIncubator) 
  shinyUI(
      bootstrapPage(
          tags$script(src = "keyboard_scroller.js") , 
          tags$link(rel="stylesheet" , type="text/css" , href="custom.css") ,
          actionButton("goButton", "Go!") , 
          selectInput("chosen_index" , "INDEX: " , list("A" = '1' , "B" = '2')) ,
          # This is the dynamic UI for the plots
          uiOutput("plots")
  ))
  </code></pre>