【问题标题】:Rstudio shiny conditionalPanel for mainPanel用于 mainPanel 的 Rstudio 闪亮的 conditionalPanel
【发布时间】:2013-11-12 11:48:40
【问题描述】:

我正在尝试创建一个具有两个不同主面板和侧面板的闪亮网页。所以在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")
                  )
      )
    )
  )
))

服务器.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

任何想法我错过了什么?

【问题讨论】:

    标签: r shiny


    【解决方案1】:

    事实证明我是在使用这个命名法来举例:

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

    如果我把它改成这个,那么它就可以了:

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

    【讨论】:

      猜你喜欢
      • 2021-11-17
      • 2019-10-23
      • 1970-01-01
      • 2019-02-12
      • 1970-01-01
      • 2018-09-21
      • 2018-03-09
      • 2013-11-15
      • 1970-01-01
      相关资源
      最近更新 更多