[英]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.