title: How to renderDataTable or renderTable for individual list elements from a list in shiny
body: <p>Say I have the following -- taking note of <code>myList</code>:</p>
  
  <pre><code>library(shiny)
  
  myList &lt;- list(
    first_element = tibble(a = 1, b = 2),
    second_element = tibble(a = 4:5, e = 7:8),
    third_element = tibble(a = c("one", "two", "three"), x = c("another", "another one", "another two"))
  )
  
  ui &lt;- fluidPage(
    titlePanel("A Title"),
    verbatimTextOutput("pretty_output")
  )
  
  server &lt;- function(input, output, session) {
    output$pretty_output &lt;- renderPrint({
      myList
    })
  }
  
  shinyApp(ui, server)
  </code></pre>
  
  <p>This results in:</p>
  
  <p><a href="https://i.stack.imgur.com/NWde3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NWde3.png" alt="Shiny App"></a></p>
  
  <p>What I would like is to present <code>myList</code> as either individual <code>renderTable</code> or <code>renderDataTable</code> elements programmatically. The following illustrates a brute force approach, but I am looking for something a little more flexible, more D.R.Y., by leveraging a for loop, <code>lapply</code>, <code>purrr::map()</code>, and/or something else.</p>
  
  <p><em>NOTE: The length of <code>myList</code> should be assumed to be unknown.</em></p>
  
  <pre><code>library(shiny)
  library(DT)
  
  myList &lt;- list(
    first_element = tibble(a = 1, b = 2),
    second_element = tibble(a = 4:5, e = 7:8),
    third_element = tibble(a = c("one", "two", "three"), x = c("another", "another one", "another two"))
  )
  
  ui &lt;- fluidPage(
    titlePanel("A Title"),
    dataTableOutput("dt_01"),
    dataTableOutput("dt_02"),
    dataTableOutput("dt_03")
  )
  
  server &lt;- function(input, output, session) {
    output$dt_01 &lt;- renderDataTable({
       datatable(myList[[1]], caption = names(myList[1]))
    })
  
    output$dt_02 &lt;- renderDataTable({
      datatable(myList[[2]], caption = names(myList[2]))
    })
  
    output$dt_03 &lt;- renderDataTable({
      datatable(myList[[3]], caption = names(myList[3]))
    })
  
  }
  
  shinyApp(ui, server)
  </code></pre>