title: Shiny dynamically select element in list and renderTable
body: <p>I have a list <code>l</code> of <code>data.frames</code>, and I want to dynamically select elements with <code>selectInput</code>. </p>
  
  <p>Once the user selects an element, I'd like to be able work with it under the hood, for example use it in <code>renderTable</code> and output a table of that <code>data.frame</code>.</p>
  
  <p>Moreover I'd like to be able to select that element in the list, and apply <code>lm</code> for example.</p>
  
  <p>The problem I'm facing is here: <code>l[[ElemInput()]]</code> how do I convert this classic <code>R</code> code with a reactive element?</p>
  
  <p>Here the complete <code>shinydashboard</code>:</p>
  
  <pre><code>library(shiny)
  library(shinydashboard)
  
  
  ui &lt;- dashboardPage(
    dashboardHeader(
      title = "My Dashboard"
    ),
    dashboardSidebar(
      sidebarMenu(
        menuItem("aaa", tabName = "aaa", icon = icon("dashboard"))
      )
    ),
    dashboardBody(
      tabItems(
        # First tab content
        tabItem(tabName = "aaa",
                h2("Dashboard aaa"),
                fluidRow(
                  box(
                      selectInput("input_name", "Select input:", choices = names(l))
                  ),
                  box(
                    dataTableOutput('table')
                  )
                )
        )
      )
    )
  )
  
  server &lt;- function(input, output) { 
    # create a fake list 
    set.seed(123)
    l &lt;- list(element1 = data.frame(aaa=1:5, bbb=sample(5)),
              element2 = data.frame(ccc=6:10, ddd=sample(5)))
  
    # reactive read element
    ElemInput &lt;- reactive({
      input$input_name
    })
  
    # render table
      output$table &lt;- renderTable({
        l[[ElemInput()]] #  this part doesn't work
      })
  
  }
  
  shinyApp(ui, server)
  </code></pre>
  
  <p>Possibly correlated questions but I couldn't figure out a solution for my case:</p>
  
  <p><a href="https://stackoverflow.com/questions/47248534/dynamically-list-choices-for-selectinput-from-a-user-selected-column?rq=1">dynamically list &#39;choices&#39; for selectInput from a user selected column</a></p>
  
  <p><a href="https://stackoverflow.com/questions/52036649/store-selectinput-in-a-string-character-object">Store selectInput in a string/character object</a></p>