我知道我错过了一些明显的东西,但由于某种原因,我无法使用 Shiny 的仪表板在 Shiny 的应用程序中进行任何操作。
我想在侧边栏中使用它来激活另一个输入。然而,在下面的代码中,虽然出现了开关,但它没有执行任何操作。
我认为关键可能在于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)
最佳答案
请注意,这是 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)
关于r - 如何将 Material 切换与shinydashboard一起使用[R],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53590859/