title: R Shiny - Subset dataframe based on reactive input
body: <p>I am building a shiny app and I need to subset a dataframe based on a user input. I have tried many different ways to do this but I keep running into errors. Currently, this seems to be the simplest method but I get the following error:</p>
  
  <p><strong>Warning in is.na(e2) : is.na() applied to non-(list or vector) of type 'closure'
  Error in <code>==.default</code>(test$MARKET, var) : comparison (1) is possible only for atomic and list types</strong></p>
  
  <p>I am pretty stuck. Does anyone have some guidance for me? Thanks!</p>
  
  <pre><code>library(shiny)
  
  shinyServer(function(input, output) {
  
        var &lt;- reactive({input$var})
  
        subsetTest &lt;- subset(test, test$MARKET==var)
  
        y &lt;- subsetTest()$PRICE
        x &lt;- subsetTest()$DATE
  
    output$ngplot &lt;- renderPlot({
      print(ggplot(data=subsetTest(), aes(x=y, y=x)) + geom_line())
    })
  })
  </code></pre>