title: R,Shiny: Using selectInput() selection to create data frame
body: <p>This seems like it should be trivial but I'm obviously missing something. I'd like to have the selection from a <code>selectInput()</code> be used to create a data frame. The <code>selectInput()</code> produces a character output that doesn't seem to work as an input for creating a data frame. My ui.R and server.R code is below. The <code>df&lt;-data.frame(input$select, header=TRUE)</code> line doesn't produce the expected output. Thanks in advance for your assistance.</p>
  
  <p>ui.R</p>
  
  <pre><code>library(shiny)
  
  shinyUI(
  
    # Use a fluid Bootstrap layout
    fluidPage(    
  
      # Give the page a title
      titlePanel("Select Test Dataset"),
  
      # Generate a row with a sidebar
      sidebarLayout(      
  
        # Define the sidebar with one input
        sidebarPanel(
          selectInput("select", "Test Dataset", 
                      choices= list("Model Year 2011" = 'cars2011', "Model Year 2012" = 'cars2012'),selected='cars2011')
  
        ),
  
        # mainPanel Output
        mainPanel(
          verbatimTextOutput("value"),
          verbatimTextOutput("type"),
          dataTableOutput(outputId="data")
        )
  
      )
    )
  )
  </code></pre>
  
  <p>server.R</p>
  
  <pre><code>library(AppliedPredictiveModeling)
  data(FuelEconomy)
  
  
  
  shinyServer(function(input, output) {
  
    output$value &lt;- renderPrint({ input$select })
    output$type &lt;- renderPrint({class(input$select)})
  
    output$data &lt;- reactive({
      df &lt;- data.frame(input$select, header=TRUE)
      head(df)
    })
  
  
  
  
  })
  </code></pre>