所以我从我的队友那里了解到,RShiny应用程序的服务器端不需要完成以显示应用程序的UI端。
这是我的一些代码:
ui <- dashboardPage(
dashboardHeader(title = "Enrolment Analytics"),
dashboardSidebar(sidebarMenu(
#can change tab names and icons here.
menuItem("Summary Tables", tabName = "Summary Tables", icon = icon("table")),
menuItem("Visualizations", tabName = "Visualizations", icon = icon("line-chart"))
)
),
dashboardBody(
tabItems(
tabItem(tabName = "Summary Tables",
fluidRow(
box(title = "Teaching Load ", status = "primary", solidHeader = TRUE,
selectInput("courseCode1", "Course code: ",
choices = as.list(unique(data1$discipline))),
numericInput("Month", "1 = January, 2 = February, ..., 12 = December", value = 6),
numericInput("Year", "2007, 2008, ..., 2017", value = 2007)
),
box(title = "Summary ", status = "primary", solidHeader = TRUE,
plotOutput("tl1"))
))
),
tabItem(tabName = "Visualizations",
fluidRow(
box(title = "Teaching Load", status = "primary", solidHeader = TRUE,
selectInput("courseCodeOne", "First discipline: ",
choices = as.list(unique(data1$discipline))),
selectInput("courseCodeTwo", "Second discipline: ",
choices = as.list(unique(data1$discipline))),
selectInput("courseCodeThree", "Third discipline: ",
choices = as.list(unique(data1$discipline)))
),
box(title = "Teaching Load Graph", status = "primary", solidHeader = TRUE,
plotOutput("tl2"))
))
)
)
当我运行应用程序时,侧边栏显示可视化和摘要表,但在服务器端,只显示可视化框,而摘要表则不显示。
答案 0 :(得分:0)
您的代码存在两个问题:
1。)tabName
不得包含空格(帮助页面中不清楚)。
2。)您有一个括号错误(tabItem
的括号中未包含第二个tabItem
。
如果你纠正了这两个错误,那么UI工作正常:
ui <- dashboardPage(
dashboardHeader(title = "Enrolment Analytics"),
dashboardSidebar(sidebarMenu(
#can change tab names and icons here.
menuItem("Summary Tables", tabName = "SummaryTables", icon = icon("table")),
menuItem("Visualizations", tabName = "Visualizations", icon = icon("line-chart"))
)
),
dashboardBody(
tabItems(
tabItem(tabName = "SummaryTables",
fluidRow(
box(title = "Teaching Load ", status = "primary", solidHeader = TRUE,
selectInput("courseCode1", "Course code: ",
choices = 1:5),
numericInput("Month", "1 = January, 2 = February, ..., 12 = December", value = 6),
numericInput("Year", "2007, 2008, ..., 2017", value = 2007)
),
box(title = "Summary ", status = "primary", solidHeader = TRUE,
plotOutput("tl1"))
)),
## BRACKET ERROR WAS HERE
tabItem(tabName = "Visualizations",
fluidRow(
box(title = "Teaching Load", status = "primary", solidHeader = TRUE,
selectInput("courseCodeOne", "First discipline: ",
choices = 1:10),
selectInput("courseCodeTwo", "Second discipline: ",
choices = 1:10),
selectInput("courseCodeThree", "Third discipline: ",
choices = 1:10)
),
box(title = "Teaching Load Graph", status = "primary", solidHeader = TRUE,
plotOutput("tl2"))
)
)
))
)
server = function(input, output, session){
}
shinyApp(ui, server)