0

I am actually trying to create a Shiny dashboard - where I need to select check boxes (in sidebarPanel - 'Datasets') based on the input value from sidebarPanel ('Treatment'). For example, if you look at the image below: When the user selects 'anti TNF-alpha' from the sidebarPanel, I want the first two checkboxes in 'Datasets' panel to be ON/Selected. And, when 'DMARds' is selected, I want the last two options in the 'Datasets' to be ON. I tried the conditionalPanel but it didn't work well for me. Could you help me with some rough code for this stuff?

Thanks in advance!

Dashboard

Harriss
  • 13
  • 1
  • 8

1 Answers1

0

Add something like this to your server file:

observe({
  selected <- input$yourSelectInput

  if (selected=="Whatever you wanted") {

    updateCheckboxGroupInput(session,
                             input$Datasets,
                             selected=c("The ones you wanted selected"))

  } else if (selected=="Something else") {

    updateCheckboxGroupInput(session,
                             input$Datasets,
                             selected=c("Different ones you wanted selected"))

  }

})
Carl
  • 5,569
  • 6
  • 39
  • 74