I am working with shiny (shiny dashboard) and also doing a forecast of my dataset through the prophet package. Shiny is working perfect, and my forecast too. Now I would like to insert the code into shiny so to plot the forecast plot inside shiny. That's not working the output on the shiny app ist just white and not showing any output.
server code:
output$fcCrime <- renderPlot({
Year12_16 <- cc[cc$Year2 %in% c("2012", "2013", "2014", "2015", "2016"),]
df <- Year12_16 %>% group_by(Date2) %>% summarise(y = n()) %>% mutate(y = log(y))
names(df) <- c("ds", "y")
df$ds <- factor(df$ds)
m <- prophet(df)
future <- make_future_dataframe(m, 365*4)
forecast <- predict(m, future)
tail(forecast[c('ds', 'yhat', 'yhat_lower', 'yhat_upper')])
#plot(m, forecast, xlabel = "Year", ylabel = "Data")+ggtitle("Forecast of Crimes in Chicago")
dyplot.prophet(m, forecast)
#prophet_plot_components(m, forecast)
})
UPDATE: Working with this dataset: https://www.kaggle.com/currie32/crimes-in-chicago
Also updates the server code. The thing is without shiny everything is plotting and working fine, but inside the shiny app its not plotting anything on the shiny dashboard.