0

我正在使用闪亮的(闪亮的仪表板)并通过先知包对我的数据集进行预测。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

还更新服务器代码。事情是没有闪亮的一切都在绘制和工作正常,但在闪亮的应用程序内部,它没有在闪亮的仪表板上绘制任何东西。

4

0 回答 0