我正在尝试创建一个具有两个不同主面板和侧面板的闪亮网页。所以在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
任何想法我错过了什么?