TabItem 输出不适用于 R Shinydashboard
TabItem Output is not working for R Shinydashboard
我正在尝试使用 Shinydashboard 构建一个简单的应用程序。其中一个 tabitem ("Raw Data") 不显示任何内容,点击它时页面也没有变化。我已经交叉检查了语法,代码 运行 没问题。不明白怎么了。
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)
感谢大家的帮助!
那是因为tabName = "Raw Data"
中的白色space。删除它,这有效。
我正在尝试使用 Shinydashboard 构建一个简单的应用程序。其中一个 tabitem ("Raw Data") 不显示任何内容,点击它时页面也没有变化。我已经交叉检查了语法,代码 运行 没问题。不明白怎么了。
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)
感谢大家的帮助!
那是因为tabName = "Raw Data"
中的白色space。删除它,这有效。