【发布时间】:2021-04-24 21:44:21
【问题描述】:
我试图有一个闪亮的侧边栏面板,其中一个输入始终存在,一个仅在选中复选框后出现。我能找到的所有相关解决方案都在谈论在output 上使用checkboxInput 作为条件,但我不确定如何实现这一点。为了显示我需要什么,这是我的代码的 sn-p:
require(shiny)
ui <- fluidPage(
titlePanel('My App'),
sidebarPanel(selectInput(inputId = "id1",
label = "something 1",
choices = c('a', 'b', 'c')),
checkboxInput("test_check", "Do you want to this?", value = FALSE),
uiOutput("test"), # checkbox to see if the user wants a comparison
selectInput(inputId = "id2",
label = "something2",
choices = c('a', 'b', 'c'))
),
mainPanel(
tabPanel("Some Info", htmlOutput(outputId = "info1"))
))
server <- function(input, output, session){}
shinyApp(ui = ui, server = server)
所以我想让id2 仅在选中复选框时出现在侧边栏中,但不知道该怎么做。谢谢。
编辑:添加了一个最小的可重现示例。
【问题讨论】:
-
请添加应用的代表
-
是的,应该想到这一点,谢谢。完成。
标签: r shiny shinydashboard