在闪亮的仪表板上使用先知包装吗?

时间:2019-01-17 02:35:13

标签: r shiny forecasting facebook-prophet

我正在使用闪亮的(发光的仪表板),还通过先知软件包对我的数据集进行了预测。 Shiny运作完美,我的预测也是如此。现在,我想将代码插入Shiny,以便在Shiny中绘制预测图。这无法使闪亮的应用程序上的输出仅显示白色,并且不显示任何输出。

服务器代码:

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)

})

更新:使用此数据集:https://www.kaggle.com/currie32/crimes-in-chicago

还更新服务器代码。问题是没有任何光泽,一切都可以正常进行,并且工作正常,但是在光泽应用程序内部,它没有在光泽仪表板上绘制任何东西。

0 个答案:

没有答案