- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是 ShinyApp 的新手。
我想将 checkboxInput() 与 conditionalPanel 一起使用,所以当它被选中时,类型的选项将显示出来(然后用户可以从“啤酒”、“提神”、“烈酒”、“酒”中选择一个类型)。如果未选中,则不会显示类型选项。
下面是我的代码,但是无论我是否选中该框,当类型选项都没有显示时。我想我应该在服务器功能中写点什么?我真的不知道。感谢您的帮助。
ui <- fluidPage(
titlePanel("BC Liquor Store prices"),
img(src = "BCLS.png",align = "right"),
sidebarLayout(
sidebarPanel(sliderInput("priceInput", "Price", 0, 100, c(25, 40), pre = "$"),
wellPanel(
checkboxInput("checkbox", "Filter by Type", FALSE),
conditionalPanel(
condition="checkbox==true",
selectInput("typeInput", "Product type",
choices = c("BEER", "REFRESHMENT", "SPIRITS", "WINE"),
selected = "WINE")
)
),
uiOutput("countryOutput")
),
mainPanel(
tabsetPanel(
tabPanel("Plot", plotOutput("coolplot")),
tabPanel("Summary", verbatimTextOutput("summary")),
tabPanel("Table", tableOutput("results"))
)
)
)
)
server <- function(input, output, session) {
output$countryOutput <- renderUI({
selectInput("countryInput", "Country",
sort(unique(bcl$Country)),
selected = "CANADA")
})
filtered <- reactive({
if (is.null(input$countryInput)) {
return(NULL)
}
bcl %>%
filter(Price >= input$priceInput[1],
Price <= input$priceInput[2],
Type == input$typeInput,
Country == input$countryInput
)
})
output$coolplot <- renderPlot({
if (is.null(filtered())) {
return()
}
filtered() %>% ggvis(~Alcohol_Content, fill := "#fff8dc") %>%
layer_histograms(width = 1, center = 0)
})
output$results <- renderTable({
filtered()
})
}
最佳答案
我最近在研究类似的 one 时遇到了这个问题。 .
似乎 checkboxInput 条件的简单答案如下:condition="input.checkbox==1",
关于r - Shiny App checkboxInput 和 conditionalPanel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34115076/
我正在尝试使用 R 中出色的 Shiny 库构建一个应用程序,我希望它能为用户生成一些错误和状态消息。为了让它工作,我将 conditionalPanel 与输出对象上的一些 bool 标志结合使用,
这会工作 checkboxInput("test", "test", TRUE), conditionalPanel( condition="input.test", h2("
这基本上是这个问题的详细示例的后续行动(没有答案): conditionalPanel in shiny (doesn't seem to work) 示例应用程序:根据用户选择显示面板(“list1
我正在使用 sidebarLayout() 开发一个 Shiny 的应用程序,我希望根据 sidebarPanel() 中的输入值在 mainPanel() 中并排显示一个或两个绘图。 如果只显示一个
我正在尝试使用 conditionalPanel 在加载文件时显示消息。但是,一旦条件为真,面板就不会消失。我在下面创建了一个可重现的代码: 服务器 library(shiny) print("Loa
Shiny 的条件面板突然出现然后消失。有什么方法可以让它们滑动或褪色或以其他方式轻轻过渡? 最佳答案 这是一种在显示元素时淡化元素的方法: js 0", id = "plotConta
正如我多次在此网站上提示的那样(shinyTree: set variable to value if checkbox is checked、shinyTree: view without sele
我想在 conditionalPanel 上设置一个条件,只要 selectInput 包含 1,conditionalPanel 就会显示。 我不熟悉 JavaScript,有人可以帮忙吗? lib
我想使用一个只有在前面的 textInput 已经完成时才会出现的条件面板(它的初始值为“”)。在 conditionalPanel 中正确定义条件的正确方法是什么。这是一个可重现的代码: ui 0
我正在使用 shinyDashboard 构建一个应用程序。我想在 sidebarMenu 中显示几个关于选定的 tabItem 和 tabPanel 的 selectInput。在不同的 tabIt
我在这里找到了一个类似的案例,不是没有具体答案:shiny: passing reactiveValues to conditionalPanel 但它给了我一个想法,我需要用 session$sen
我很难理解条件面板。 最初,我想显示一个面板,其中包含有关如何使用该应用程序(税收计算器)的说明。一旦用户将输入更改为他们的规范并按下更新,第二个条件面板就会出现。 目前该应用程序在第一轮运行,但随后
我是 ShinyApp 的新手。 我想将 checkboxInput() 与 conditionalPanel 一起使用,所以当它被选中时,类型的选项将显示出来(然后用户可以从“啤酒”、“提神”、“烈
我想知道是否可以在 conditionalPanel 中添加多个条件在 Shiny 。这是一个例子: conditionalPanel(condition = "input.SELECT == 1"
我可以将 reactiveValues 传递给 conditionalPanel 的条件吗?如果是,怎么办? 这是我在 conditionalPanel ui.R 中尝试过的: conditional
我的界面中需要多个选项卡,并且在每个选项卡中我都想使用 conditionalPanel。正如您将在下面的可重现代码中看到的,conditionalPanel 在第一个选项卡中有效,但在其他选项卡中无
我对为什么我的 selectInput 不起作用感到困惑。 包含 conditionalPanel 后,突然在 selectInput 中将名字从 John Doe 切换为 Joe Blow 不再有效
我有一个非常基本的 Shiny 应用程序。 我正在使用 renderUI 和 uiOutput 来填充可以选择日期的 selectInput。 但如果用户通过单选按钮选择一个选项,我只希望 selec
我正在 Shiny 应用程序中创建一个条件面板。我正在尝试调试 JavaScript 条件,但没有检查它,我只是猜测随机的 JavaScript 位。有没有办法直接检查条件? selectizeInp
条件面板不会在我 Shiny 的应用程序中显示消息“正在加载...”。当按下所有小部件时,必须出现消息。 sidebarPanel(id="sidebar", tex
我是一名优秀的程序员,十分优秀!