【发布时间】:2019-04-27 17:47:40
【问题描述】:
当使用日期序列(从 2018 年 1 月到 2018 年 10 月的月份)创建具有值列表的数据框时,我有以下几行:
sales <- c(429, 400, 986, 618, 754, 424, 289, 401, 916, 852)
periods <- seq(as.Date("2018/1/1"), as.Date("2018/10/1"), "months")
Passengers <- data.frame(sales, periods)
pax <- ts(Passengers)
ggplot(pax, aes(x = months, y = sales)) + geom_line(colour = "grey75")
输出没有显示一列句点:
Time Series:
Start = 1
End = 10
Frequency = 1
sales periods
1 429 17532
2 400 17563
3 986 17591
4 618 17622
5 754 17652
6 424 17683
7 289 17713
8 401 17744
9 916 17775
10 852 17805
月份的 x 轴不像月份那样显示,我怎样才能让它以 yyyy-mm 格式显示?谢谢。
【问题讨论】:
-
期间列显示以月为间隔的日期对象的数值。我不知道需要“纠正”什么。
标签: r time time-series