【发布时间】:2018-11-08 23:01:04
【问题描述】:
我希望如果选择了 checkboxInput 因子参数,这将使应用程序显示一个带有多个选项的新 selectInput。
这是一个最小的工作示例。
library(shiny)
ui <- fluidPage(
titlePanel("Old Faithful Geyser Data"),
sidebarLayout(
sidebarPanel(
sliderInput("bins",
"Number of bins:",
min = 1,
max = 50,
value = 30),
checkboxInput("fixed", "Factorial parameters"),
conditionalPanel(condition = "fixed == 'TRUE'",
selectInput("choice",
"Choose your fixed parameter",
c("alpha"= "Alpha", "beta"="Beta"),
selected = "alpha"))
)
,
mainPanel(
plotOutput("distPlot")
)
)
)
server <- function(input, output) {
output$distPlot <- renderPlot({
x <- faithful[, 2]
bins <- seq(min(x), max(x), length.out = input$bins + 1)
hist(x, breaks = bins, col = 'darkgray', border = 'white')
})
}
shinyApp(ui = ui, server = server)
谁能告诉我我做错了什么?
非常感谢!
【问题讨论】:
标签: shiny