TabItem输出不适用于R Shinydashboard

问题描述 投票:0回答:1

我正在尝试使用Shinydashboard构建一个简单的应用程序。一个选项项目(“原始数据”)不显示任何内容,并且在单击时页面也不会更改。我已经交叉检查了语法,并且代码运行正常。不明白怎么了。

Ui.R-

header = dashboardHeader(title="COVID-19 Tracker")

sidebar =   dashboardSidebar(collapsed = TRUE,
                   sidebarMenu(menuItem("Dashboard", tabName = "Dashboard",icon = icon("globe")),
                               menuItem("Raw Data", tabName = "Raw Data", icon = icon("database")),
                               menuItem("Graphs",tabName = "Graphs", icon = icon("chart-bar"))
                               ))
body =  dashboardBody(
  tabItems(
    tabItem(tabName = "Dashboard",
                   fluidRow(valueBox(10*3, "Cases", width = 4), 
                            valueBoxOutput("Recovered", width = 4), 
                            valueBoxOutput("Deaths", width = 4)
                            )
                   ),
    tabItem(tabName = "Raw Data", h2("Raw Data has been loaded!")
                   ),
    tabItem(tabName = "Graphs",fluidRow(
             column(
               width=4, 
               selectizeInput(
                 "country", label=h5("Country"), choices=NULL, width="100%")
             ),
             column(
               width=4, 
               selectizeInput(
                 "state", label=h5("State"), choices=NULL, width="100%")
             ),
             column(
               width=4, 
               checkboxGroupInput(
                 "metrics", label=h5("Selected Metrics"), 
                 choices=c("Confirmed", "Deaths", "Recovered"), 
                 selected=c("Confirmed", "Deaths", "Recovered"), 
                 width="100%")
             )
           ),
           fluidRow(
             plotlyOutput("dailyMetrics")
           ),
           fluidRow(
             plotlyOutput("cumulatedMetrics"))
           )
  )
)

ui = dashboardPage(header, sidebar, body)

我感谢所有帮助!

r web-applications shiny shinydashboard tabitem
1个回答
0
投票

这是因为tabName = "Raw Data"中的空白。删除它,这有效。

© www.soinside.com 2019 - 2024. All rights reserved.