0

I have a drop down menu which is a selectizeInput - using which I need to subset my dataframe for analysis further.

Consider the following,

d - dataframe (has a column named 'test')

menu - the selectizeInput drop down

d[d$test %in% input$menu, ]

This doesn't do what I actually need to. Any thoughts?

Harriss
  • 13
  • 1
  • 8

1 Answers1

0

It should work.

ui

library(shiny)

shinyUI(fluidPage(

  sidebarLayout(
    sidebarPanel(
      selectizeInput("in", "in", choices = as.list(letters[1:10]), multiple = TRUE)
    ),

    mainPanel(
      verbatimTextOutput("view")
    )
  )
))

server

library(shiny)

d <- data.frame(test = letters[1:10], value = 1:10)

shinyServer(function(input, output) {

  view <- reactive({d[d$test %in% input$"in", ]})

  output$view <- renderPrint(view())

})
mRcSchwering
  • 820
  • 8
  • 25