问题描述
我尝试使用rstudio中的Shinydashboard创建仪表板。但是,当我尝试运行该应用程序时出现以下错误。如何在没有以下未使用参数错误的情况下运行仪表板:skin ='red; ?我是否缺少要安装的库并要求它发生?
sp <- read.csv("GSPC.csv",stringsAsFactors = FALSE,header = TRUE)
library(shiny)
library(semantic.dashboard)
library(shinydashboard)
library(ggplot2)
sp$Date = as.Date(sp$Date,format = "%m/%d/%Y")
ui <- dashboardPage(skin = "red",# Application title
dashboardHeader(title = "My Dashboard"),dashboardSidebar("Hello"),# Show a plot of the generated distribution
dashboardBody(
frow1 <- fluidRow( valueBoxOutput("value1"),valueBoxOutput("value2"),valueBoxOutput("value3")),frow2 <- fluidRow( Box( title = "High",status = "primary",solidHeader = TRUE,collapsible = TRUE,plotOutput("highPlot",height = "300px") ),Box( title = "Low",plotOutput("lowPlot",# combine the two fluid rows to make the bodybody <- dashboardBody(frow1,frow2)
Box( title = "Close Graph",plotOutput("distPlot"),width = 9),Box(selectInput("features","Features:",c("High","Low","Open","Close"))),width = 4,#daterangeInput("dates","Date range",# c("Date",start = "1927/12/31",end = as.character(Sys.Date()) )),#start = "1927/12/31",end = as.character(Sys.Date())),)
))
# Define server logic required to draw a histogram
server <- function(input,output) {
output$distPlot <- renderPlot({
plot(sp$Date,sp[[input$features]],xlab = "Date",ylab = "Feature",col = 'brown',type = "l")
})
output$highPlot <- renderPlot({
hist(sp$High,main = "Histogram of High",col="purple",border="white",)
})
output$lowPlot <- renderPlot({
hist(sp$Low,main = "Histogram of Low",col="chocolate",border="brown",)
})}
# Run the application
shinyApp(ui = ui,server = server)
解决方法
我知道这是一个老问题,但我一直在为同样的问题苦苦挣扎。我通过不加载“semantic.dashboard”来解决它。只需删除print(f"Goblin's HP is Now: {goblinghp}")
。似乎存在兼容性问题。