Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
shinydashboard选项卡项目不工作_R_Shiny_Shinydashboard - Fatal编程技术网

shinydashboard选项卡项目不工作

shinydashboard选项卡项目不工作,r,shiny,shinydashboard,R,Shiny,Shinydashboard,我有一个简单的闪亮仪表板,侧菜单中有四个选项卡,出于某种原因,当我构建闪亮应用程序时,单击侧菜单不会显示新页面,而tab2的内容只是将其自身附加到tab1 搜索stackoverflow时向我显示了以下问题:,答案不适用于我,因为我没有使用rmd,我也不打算将其托管到AWS服务器 以下是代码供参考: ui <- dashboardPage( dashboardHeader(title = "Study Dashboard"), dashboardSidebar( sidebarMenu(

我有一个简单的闪亮仪表板,侧菜单中有四个选项卡,出于某种原因,当我构建闪亮应用程序时,单击侧菜单不会显示新页面,而tab2的内容只是将其自身附加到tab1

搜索stackoverflow时向我显示了以下问题:,答案不适用于我,因为我没有使用rmd,我也不打算将其托管到AWS服务器

以下是代码供参考:

ui <- dashboardPage(
dashboardHeader(title = "Study Dashboard"),
dashboardSidebar(
sidebarMenu(
  menuItem("Overall Objectives", tabName = "objectives"),
  menuItem("Wellpad Operator", tabName = "wellpad_operator"),
  menuItem("Wastewater Expert", tabName = "wastewater_expert"),
  menuItem("Freshwater Expert", tabName = "freshwater_expert"),
  menuItem("Environmental Impact", tabName = "environ_impact")
)
),
dashboardBody(
#Tab 1 Objective View
tabItems(
  tabItem(tabName = "objectives", 
          h2("Overall Objectives"),
          fluidRow(
            box(
              title = "Overall Objective Comparison", width = 6, solidHeader = TRUE,
              plotOutput("objective_plot")
            ),
            box(
              title = "Cost Category Breakdown", width = 6, solidHeader = TRUE,
              plotOutput("costbreakdown_plot")
            ),
            box(
              title = "Decision Variables", width = 12, solidHeader = TRUE,
              tableOutput("decision_table"))
          ))
),

#Tab 2 Wellpad Decision
tabItem(tabName = "wellpad_operator", 
        h2("Wellpad Operator") 
        ),

#Tab 3 Wastewater Expert
tabItem(tabName = "wastewater_expert",
        h2("Wastewater Expert")
        ),

#Tab 4 Freshwater Expert
tabItem(tabName = "freshwater_expert",
        h2("Freshwater Expert")
        ),

#Tab 5 Environmental Damages
tabItem(tabName = "environ_impact",
        h2("Environmental Impact"))
)
)

server <- function(input, output) {
#server side code that generates the plots
}

shinyApp(ui = ui, server = server)

ui您需要将所有
tabItem
放入
tabItems
中。试试这个:

dashboardBody(
    #Tab 1 Objective View
    tabItems(
      tabItem(tabName = "objectives", 
              h2("Overall Objectives"),
              fluidRow(
                box(
                  title = "Overall Objective Comparison", width = 6, solidHeader = TRUE,
                  plotOutput("objective_plot")
                ),
                box(
                  title = "Cost Category Breakdown", width = 6, solidHeader = TRUE,
                  plotOutput("costbreakdown_plot")
                ),
                box(
                  title = "Decision Variables", width = 12, solidHeader = TRUE,
                  tableOutput("decision_table"))
              )),
      #Tab 2 Wellpad Decision
      tabItem(tabName = "wellpad_operator", 
              h2("Wellpad Operator") 
      ),

      #Tab 3 Wastewater Expert
      tabItem(tabName = "wastewater_expert",
              h2("Wastewater Expert")
      ),

      #Tab 4 Freshwater Expert
      tabItem(tabName = "freshwater_expert",
              h2("Freshwater Expert")
      ),

      #Tab 5 Environmental Damages
      tabItem(tabName = "environ_impact",
              h2("Environmental Impact"))
    )
)

哇,那是我犯的一个愚蠢的错误。教我不要正确跟踪支架。谢谢你帮我把这个挖出来!总是发生在我身上,闪闪发光!相应的括号可以彼此相距如此之远…谢谢,这也帮助了我!