【问题标题】:TabItem Output is not working for R ShinydashboardTabItem 输出不适用于 R Shinydashboard
【发布时间】:2020-07-23 21:56:33
【问题描述】:

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

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】:

    这是因为tabName = "Raw Data" 中的空白。删除它就可以了。

    【讨论】:

      猜你喜欢
      • 2019-07-25
      • 2016-12-14
      • 1970-01-01
      • 2018-04-08
      • 1970-01-01
      • 1970-01-01
      • 2020-06-15
      • 2021-01-13
      • 2016-10-17
      相关资源
      最近更新 更多