Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201867

In flexdashboard I want to make a year input slider but I'm getting an error in my reactive statement i guess

$
0
0

In my dashboard I want to create a year range input slider. But I'm getting the following error:

Tibble columns must have consistent lengths, only values of length one are recycled: * Length 0: Columns y, linetype, .plotlyGroupIndex * Length 2: Column x

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

Inputs {.sidebar data-width=350}


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

Column

Chart 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)
  })


Viewing all articles
Browse latest Browse all 201867

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>