6

2 つの異なるメイン パネルとサイド パネルを持つ光沢のある Web ページを作成しようとしています。したがって、sidebarPanel で「ケース A」を選択すると、特定の tabsetPanel を持つ特定の mainPanel が必要になります。これは、「ケース 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

私が見逃しているアイデアはありますか?

4

1 に答える 1

6

この命名法を使用して例を挙げていたことがわかりました。

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

これに変更すると、動作します:

condition = "input.plotType=='Case B'"
于 2013-11-01T10:13:06.293 に答える