繁体   English   中英

shiny 中的 ConditionalPanel 没有响应

[英]ConditionalPanel in shiny isn't responding

tabPanel("Incidence",
   sidebarLayout(
      sidebarPanel(
             selectInput(
                       "incidence", "Select Cancer Incidence Rates By:",
                        choices = c("Age" = "I_Age",
                                    "Cancer Type" = "I_Site",
                                    "Trends" = "I_Trend",
                                    "Trend By Age" = "I_Tr_Age",
                                    "Admission Type" = "I_Admin",
                                    "Stage" = "I_Stage",
                                    "Stage By Age" = "I_St_Age",
                                    "Cancer Detected By Screening" = "I_Screen",
                                                   )
                                     ),
                                     conditionalPanel(
                                       condition = "input.incidence !== 'Trend By Age' || 
                                                    input.incidence !== 'Stage By Age' || 
                                                    input.incidence !== 'Cancer Type'",
                                    selectInput("gender","Gender",
                                                   choices = unique(table$Gender))
                                     )

我试图调整性别面板,我不希望性别输入按年龄、年龄阶段和癌症类型进行趋势。 我不确定我哪里错了。 有人可以帮我解决这个问题吗?

正如@amanwebb 指出的那样,只需替换|| &&的运营商:

library(shiny)

ui <- fluidPage(
  #tabPanel("Incidence",
           sidebarLayout(
             sidebarPanel(
               selectInput(
                 "incidence", "Select Cancer Incidence Rates By:",
                 choices = c("Age" = "I_Age",
                             "Cancer Type" = "I_Site",
                             "Trends" = "I_Trend",
                             "Trend By Age" = "I_Tr_Age",
                             "Admission Type" = "I_Admin",
                             "Stage" = "I_Stage",
                             "Stage By Age" = "I_St_Age",
                             "Cancer Detected By Screening" = "I_Screen")
               ),
               conditionalPanel(
                 condition = "input.incidence !== 'I_Tr_Age' && input.incidence !== 'I_St_Age' && input.incidence !== 'I_Site'",
                 selectInput("gender","Gender", choices = c("aer", "aer2"))
                 )
               ), mainPanel()
))

server <- function(input, output, session) {
  
}

shinyApp(ui, server)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM