在flexdashboard中,我想制作一个年份输入滑块,但我的反应式声明中出现错误,我猜

时间:2019-10-26 12:38:01

标签: r shiny shinydashboard flexdashboard

在我的仪表板上,我想创建一个年份范围输入滑块。但出现以下错误:

标题列必须具有一致的长度,只有长度为1的值才被回收: *长度0:列ylinetype.plotlyGroupIndex *长度2:第x

Avg <- Hollywood %>% group_by(Genre,year)
Avg <-Avg %>% summarise(avg_Gross=mean(WorldwideGross, na.rm = TRUE))
Avg$year <- factor(Avg$year)

输入{.sidebar data-width = 350}


 sliderInput("Year", "year", 2005, 2014, value = c(2005, 2014), sep = "")

图B

average <- reactive({
  Avg[Avg$year==input$Year,]
})

renderPlotly({
  p2 <- plot_ly(average(), x = input$Year, y = ~avg_Gross, type = 'scatter', mode = 'lines', linetype = ~Genre) 
  print(p2)
  })

0 个答案:

没有答案