R 闪亮条件面板永远不会显示,即使满足条件也是如此

  • 本文关键字:条件 满足 永远 显示 r shiny
  • 更新时间 :
  • 英文 :


如果用户选择不只保留名词和形容词("pos"选择输入设置为FALSE),那么系统应提示他们是否应删除非索引字("stop"选择输入)。

但是,尽管我小心翼翼地用 JS 而不是 R 编写条件,但即使满足条件,条件面板也永远不会显示。我被难住了。

最小可重现示例:

shinyApp(
ui = shinyUI(fluidPage(
fluidRow(
column (2,
wellPanel(
h5("Parameters"),
tabsetPanel(
tabPanel("Text",
selectInput("pos", label = h5("Keep only nouns & adjectives?"), choices = list("Yes" = TRUE, "No" = FALSE), selected = TRUE),
conditionalPanel(
condition = "input.pos == false",
selectInput("stop", label = h5("Remove stopwords?"), choices = list("Yes" = TRUE, "No" = FALSE), selected = TRUE)
)))))))),
server = shinyServer(function(input, output) {
})
)

您的条件需要引号和大写...

shinyApp(
  ui = shinyUI(fluidPage(
    fluidRow(
      column (2,
              wellPanel(
                h5("Parameters"),
                tabsetPanel(
                  tabPanel("Text",
                           selectInput("pos", label = h5("Keep only nouns & adjectives?"), choices = list("Yes" = TRUE, "No" = FALSE), selected = TRUE),
                           conditionalPanel(
                             condition = "input.pos == 'FALSE'",
                             selectInput("stop", label = h5("Remove stopwords?"), choices = list("Yes" = TRUE, "No" = FALSE), selected = TRUE)
                           )))))))),
  server = shinyServer(function(input, output) {
  })
)

最新更新