【发布时间】:2016-01-18 13:28:14
【问题描述】:
在我使用 RShiny 的第一个项目期间,我在使用金字塔库 (https://cran.r-project.org/web/packages/pyramid/index.html) 时遇到了问题。 代码执行没有错误,但我没有在闪亮的应用程序中获得显示结果。
这里是 server.R 文件和 UI.R 文件中的相关代码:
服务器.R:
output$effectifStartAgrege <- renderPlot({
staff <- read.xlsx('C:/file.xlsx', 1)
pyramid(staff, main = "Statistics")
})
ui.R:
shinyUI(fluidPage(
dashboardBody(
tabItems(
tabItem(tabName = "Team D",
tabBox(
title = "Team detailed compositions",
width = 400,
id = "tabset2", height = "250px",
tabPanel("START", "First tab content",
plotOutput("effectifStartAgrege")))
)
)
)
))
以及 dput(staff) 的输出:
structure(list(Grade = structure(c(4L, 1L, 2L, 6L, 7L, 8L, 5L,
9L, 3L), .Label = c("AD", "AE", "AS/ED", "I", "M", "S1", "S2",
"S3", "SM"), class = "factor"), Assurance = c(6, 7, 0, 8, 7,
0, 7, 2, 4), Pension = c(0, 10, 0, 2, 3, 0, 2, 1, 2), Analytics = c(3,
3, 0, 2, 2, 0, 1, 1, 0)), .Names = c("Grade", "Assurance", "Pension",
"Analytics"), row.names = c(NA, -9L), class = "data.frame")
【问题讨论】:
-
请在您的帖子中添加一些数据(粘贴
dput(staff)或dput(staff[1:20,])的输出),以便我们运行示例。