【发布时间】:2016-04-17 02:36:53
【问题描述】:
假设我有以下代码...
ui.r
library(shiny)
ui <- fluidPage(
actionButton("fishButton", label = "Fish"),
checkboxGroupInput("Check1",label=h4 ("Fish:"), choices = c("Bass","Shark","Tuna")),
actionButton("reptileButton", label = "Reptile"),
checkboxGroupInput("Check2",label=h4 ("Reptile:"), choices = c("Komodo","Skink","Snake")),
actionButton("mammalButton", label = "Mammal"),
checkboxGroupInput("Check3",label=h4 ("Mammals:"), choices = c("Dog","Cat","Bear")),
actionButton("birdButton", label = "Bird"),
checkboxGroupInput("Check4",label=h4 ("Birds:"), choices = c("Budgie","Parrot","Cockatiel")),
actionButton("amphibianButton", label = "Amphibian"),
checkboxGroupInput("Check5",label=h4 ("Amphibian:"), choices = c("Frog","Toad","Salamander"))
)
有没有办法使用条件面板通过单击相应的 actionButton 来隐藏/显示 checkboxGroups?据我了解,actionButton 仅存储一个从 0 开始并随着按钮的每次单击而增加 1 的整数,这在这种情况下似乎没有多大帮助。是否有可能有一个仅在其 actionButton 值为偶数或类似数字时才显示的条件面板?
【问题讨论】:
-
您可以在 ui 端使用 uiOutput() 和在服务器端(可能)生成的 checkboxGroupInput() 来执行此操作。我没有做过这个具体的事情,但一直使用服务器端输入。