title: Assigning variable from selectInput in Shiny - R
body: <p>I am trying to do an exercise in Shiny, where I select some variable from a menu. The options in the menu have the same name as variable in a dataset. I would then like to make some prediction between the variables which have been selected. 
  My data set looks like:    </p>
  
  <pre><code>head(MegaReport)
           DATE HOUR         STATION  FSP  NO2  NOX   O3  RSP  SO2
  160873 1990-01-01    1 CENTRAL/WESTERN N.A. N.A. N.A. N.A. N.A. N.A.
  160874 1990-01-01    2 CENTRAL/WESTERN N.A.   60   62 N.A. N.A.    3
  160875 1990-01-01    3 CENTRAL/WESTERN N.A.   44   46 N.A. N.A.    5
  160876 1990-01-01    4 CENTRAL/WESTERN N.A.   40   42 N.A. N.A.    4
  160877 1990-01-01    5 CENTRAL/WESTERN N.A.   33   33 N.A. N.A.    6
  160878 1990-01-01    6 CENTRAL/WESTERN N.A.   32   34 N.A. N.A.    4
  </code></pre>
  
  <p>The code that i built is:</p>
  
  <pre><code> ## Only run examples in interactive R sessions
  if (interactive()) {
  # demoing optgroup support in the `choices` argument
  shinyApp(
  ui = fluidPage(
    sidebarLayout(
      sidebarPanel(
  
        selectInput("Pollutant", "Choose the first pollutant:",
                    list(`Nitrogen` = c("NO", "NO2"),
                         `Ozone` = "O3",
                         `Particulate` = c("RSP", "FSP", "IA"))
        ),
  
        selectInput("Pollutant2", "Choose the second pollutant:",
                    list(`Nitrogen` = c("NO2", "NO"),
                         `Ozone` = "O3",
                         `Particulate` = c("RSP", "FSP", "IA"))      )
      ),
      mainPanel(
        sidebarPanel(
          textOutput("result"),
          textOutput("result2"),
          tableOutput("data")
        )
      )
    )),
  server = function(input, output) {
    output$result &lt;- renderText({
      paste("Active Pollutant 1", input$Pollutant)
    })
    output$result2 &lt;- renderText({
      paste("Active Pollutant 2", input$Pollutant2)
    })
    output$data &lt;- renderTable({
      MegaReport[, c(input$Pollutant, input$Pollutant2), drop = FALSE]
    }, rownames = TRUE)
  })}
  </code></pre>
  
  <p>But when i run it, I cannot generate the new dataset that will select only the two columns from the initial dataset based on the 2 variables selected by the user. </p>
  
  <p>Does anyone knows how to do please? what seem wrong to you ?</p>