lundi 21 août 2017

R Shiny checkboxGroup filter when unchecked

I have a checkbox on the shinydashboard side panel that is used to subset the data on a binary variable (0, 1). If unchecked no filter should apply.

So far I have this in ui

checkboxGroupInput("patFilt", 
                   label = h5("Filter by patient cohort"),
                   choices = c("Patient cohort" = 1),
                   selected = 0,
                   width = "100%")

and in my server.R I have

reactiveFilter <- reactive(
    ifelse(is.null(input$patFilt), c(0, 1), 1)
  )

However the default option only returns the observations marked 0 until the box is checked then it correctly returns the observations marked 1.

How do I get it so that when the checkbox is unchecked all observations are returned?

Thanks




Aucun commentaire:

Enregistrer un commentaire