我知道我缺少明显的东西,但是由于某种原因,我无法使用Shinydashboard在实际的应用程序中进行任何实质性的切换。
我想在侧边栏中使用它来激活另一个输入。但是,使用下面的代码,尽管出现了开关,但是它什么也没做。
我认为密钥可能处于conditionalPanel的条件下...
library("shiny")
library("shinydashboard")
library("shinyWidgets")
sidebar <- dashboardSidebar(materialSwitch(inputId = "check",
label = h4("View by options")),
conditionalPanel(condition = "input.check == TRUE",
awesomeRadio(inputId = "options", label = NULL, choices = c("A", "B", "C"),
selected = c("A"))))
body <- dashboardBody()
ui <- dashboardPage(dashboardHeader(title = "Example"),
sidebar,
body
)
server <- function(input, output) {
}
shinyApp(ui, server)
答案 0 :(得分:2)
请注意,这是javascript
有条件的,因此它不知道TRUE
是什么R
评估,请将其更改为true
library("shiny")
library("shinydashboard")
library("shinyWidgets")
sidebar <- dashboardSidebar(materialSwitch(inputId = "check",
label = h4("View by options")),
conditionalPanel(condition = "input.check == true",
awesomeRadio(inputId = "options", label = NULL, choices = c("A", "B", "C"),
selected = c("A"))))
body <- dashboardBody()
ui <- dashboardPage(dashboardHeader(title = "Example"),
sidebar,
body
)
server <- function(input, output) {
}
shinyApp(ui, server)