【发布时间】:2019-02-01 15:21:29
【问题描述】:
我希望将条形图嵌入到应用程序中。向量 d 的输出给我的结果是我希望将其嵌入到 shinyapp 中,稍后我也想让它具有交互性。
library(ggplot2)
driver1 <- read.csv("E:/RMARKDOWN/shiny/driver.csv",header = T)
New_DataSet1<-
data.frame(driver1$ï..Year_AG,driver1$Severity_Desc,driver1$Injury.Type)
New_DataSet1
latest <- New_DataSet1[1:100,]
latest
d <- aggregate(latest$driver1.Injury.Type, by=list(chkID =
latest$driver1.Severity_Desc), FUN=sum)
ui <- dashboardPage(
dashboardHeader(title = "Row layout"),
dashboardSidebar(),
dashboardBody()
)
server <- function(input, output) {
#output$plot <- renderPlot({ barplot(d$x, xlab = d$chkID) })
renderPlot(d$x)
#barplot(d$x, xlab = d$chkID)
# barplot(d$x, names.arg = d$chkID)
}
shinyApp(ui,server)
【问题讨论】:
-
我已经为您添加了解决方案。如果有更多信息,请您检查并告诉我!
标签: r shiny shinydashboard