在我的仪表板上,我想创建一个年份范围输入滑块。但出现以下错误:
标题列必须具有一致的长度,只有长度为1的值才被回收:
*长度0:列y
,linetype
,.plotlyGroupIndex
*长度2:第x
列
Avg <- Hollywood %>% group_by(Genre,year)
Avg <-Avg %>% summarise(avg_Gross=mean(WorldwideGross, na.rm = TRUE))
Avg$year <- factor(Avg$year)
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)
})