我正在尝试从时间序列数据创建一个方面图...
if(!require('fma')){
install.packages("fma")
library(fma)
}
if(!require('ggfortify')){
install.packages("ggfortify")
library(ggfortify)
}
ec <- ts(econsumption, frequency = 12)
ec
这导致...
Mwh temp
Jan 1 16.3 29.3
Feb 1 16.8 21.7
Mar 1 15.5 23.7
Apr 1 18.2 10.4
May 1 15.2 29.7
Jun 1 17.5 11.9
Jul 1 19.8 9.0
Aug 1 19.0 23.4
Sep 1 17.5 17.8
Oct 1 16.0 30.0
Nov 1 19.6 8.6
Dec 1 18.0 11.8
但是,当我尝试绘图时,x 轴并不像预期的那样......
autoplot(ec, facet=T)
输出 ...
我期待 autoplot 在 x 轴上自动设置 12 个月。我究竟做错了什么?
笔记 ...
str(ec)
结果是 ...
Time-Series [1:12, 1:2] from 1 to 1.92: 16.3 16.8 15.5 18.2 15.2 17.5 19.8 19 17.5 16 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:2] "Mwh" "temp"