繁体   English   中英

用于mainPanel的Rstudio有光泽的conditionalPanel

[英]Rstudio shiny conditionalPanel for mainPanel

我正在尝试创建一个闪亮的网页,它将有两个不同的主面板和侧面板。 因此,当在sidebarPanel中选择“Case A”时,我想要一个具有特定tabsetPanel的特定mainPanel,如果我选择“Case B”,则会有所不同。 阅读完文档后,我陷入了困境:

ui.R:

shinyUI(pageWithSidebar(
  headerPanel("This is a Shiny page"),
  sidebarPanel(
     selectInput(
        "plotType", "Plot Type",
        c("Case A","Case B")
         )
  ),
  mainPanel(
    conditionalPanel(
      condition(input.plotType == 'Case A'),
       tabsetPanel(
         tabPanel("A1",
           textOutput("This is conditionalPanel A1")
                  ),
         tabPanel("A2",
           textOutput("This is conditionalPanel A2")
                  )
         )
     ),
    conditionalPanel(
      condition(input.plotType == 'Case B'),
      tabsetPanel(
        tabPanel("B1",
          textOutput("This is conditionalPanel B1")
                  ),
        tabPanel("B2",
          textOutput("This is conditionalPanel B2")
                  )
      )
    )
  )
))

server.R:

shinyServer(function(input, output) {
})

我收到此错误:

Listening on port 50709
Error in tag("div", list(...)) : could not find function "condition"
Calls: runApp ... tag -> conditionalPanel -> div -> <Anonymous> -> tag
Error in setwd(orig.wd) : cannot change working directory
Calls: runApp ... conditionalPanel -> div -> <Anonymous> -> tag -> setwd
Execution halted

有什么想法我错过了什么?

事实证明我正在使用这个命名法做一个例子:

condition(input.plotType == 'Case B')

而如果我改变它,那么它的工作原理:

condition = "input.plotType=='Case B'"

暂无
暂无

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

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