0

我实际上是在尝试创建一个闪亮的仪表板 - 我需要根据来自 sidebarPanel('Treatment')的输入值选择复选框(在 sidebarPanel - 'Datasets'中)。例如,如果您查看下图:当用户从侧边栏面板中选择“anti TNF-alpha”时,我希望“数据集”面板中的前两个复选框处于打开/选中状态。And, when 'DMARds' is selected, I want the last two options in the 'Datasets' to be ON. 我尝试了conditionalPanel,但对我来说效果不佳。你能帮我写一些粗略的代码吗?

提前致谢!

仪表板

4

1 回答 1

0

将类似这样的内容添加到您的服务器文件中:

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"))

  }

})
于 2016-07-21T21:13:48.893 回答