I am trying to build a simple app using Shinydashboard. One of the tabitems ("Raw Data") does not display anything and neither the page changes when clicked on it. I have cross-checked the syntax and the code is running fine. Don't understand what's wrong.
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)
I appreciate all the help!
That's because of the white space in tabName = "Raw Data"
. Remove it and this works.