【发布时间】:2016-12-14 00:54:56
【问题描述】:
我正在尝试在 R 中构建预测图。但是,尽管尝试了许多解决方案,但我无法在日期中绘制 X 轴。
我的数据格式为:
Datetime(MM/DD/YYY) ConsumedSpace
01-01-2015 2488
02-01-2015 7484
03-01-2015 4747
下面是我正在使用的预测脚本:
library(forecast)
library(calibrate)
# group searches by date
dataset <- aggregate(ConsumedSpace ~ Date, data = dataset, FUN= sum)
# create a time series based on day of week
ts <- ts(dataset$ConsumedSpace, frequency=6)
# pull out the seasonal, trend, and irregular components from the time series (train the forecast model)
decom <- stl(ts, s.window = "periodic")
#predict the next 7 days of searches
Pred <- forecast(decom)
# plot the forecast model
plot(Pred)
#text(Pred,ts ,labels = dataset$ConsumedSpace)
输出看起来像这样——你可以看到我显示的 X 轴是句点(数字)而不是数据格式。
非常感谢任何帮助。
【问题讨论】:
标签: r plot time-series powerbi rscript