0

I am trying to subset a spatial data frame using an input from InputSelect in a shiny app.

  1. outside of the app this is working :

    SDF2 <- SDF1%>% subset(VAR >200)
    
  2. inside the shiny app this is NOT working =>

-in the UI :

  selectInput("choice", "", choices = "VAR" )

-in the Server :

   InputVar<-input$choice
   SDF2 <- SDF1 %>% subset(InputVar >200)

Why 1 works and 2 doesn't ?

Any hint would be really appreciated !

akrun
  • 874,273
  • 37
  • 540
  • 662
  • 1
    Try this: `SDF2 <- reactive({ SDF1 %>% subset(input$choice > 200) })`. And most likely `VAR` should not be quoted here: `choices = "VAR"`. But if you really want help you should provide a [fully reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – nrussell Jul 07 '15 at 19:17
  • 1
    @nrussell But `input$choice` will still be a string. You cannot use `subset()` with a column name specified by string. This question probably address the real issue: http://stackoverflow.com/questions/17075529/r-subset-based-on-variable-column-name – MrFlick Jul 07 '15 at 19:28
  • @MrFlick That's a very good point. – nrussell Jul 07 '15 at 19:30
  • @MrFlick, this was exactly where my problem lay. Thak you a lot ! – tryingShiny Jul 08 '15 at 05:42
  • Thank you @nrussell as well for your reply! – tryingShiny Jul 08 '15 at 05:42

0 Answers0