[问题类型]:
程式咨询(我想用R 做某件事情,但是我不知道要怎么用R 写出来)
[软件熟悉度]:
入门
[问题叙述]:
no ;created_time
247 ;2017/10/31
246 ;2017/10/31
245 ;2017/10/30
244 ;2017/10/29
243 ;2017/10/28
242 ;2017/10/27
241 ;2017/10/24
240 ;2017/10/22
.
.
.
7 ;2016/7/14
6 ;2016/7/13
5 ;2016/7/13
4 ;2016/7/11
3 ;2016/7/9
2 ;2016/7/8
1 ;2016/7/7
以上是我的资料,
总共有247个,时间横跨16个月,
中间日期没有一定的间隔,但每个月都有资料,
第一栏的编号则是会连到另一个汇入的档案。
data$created_time <- as.Date(data$created_time, "%Y/%m/%d")
posttime <- levels(factor(data$created_time))
posttime<- as.Date(posttime, "%Y-%m-%d")
然后因为我要画图,
X轴就是要用时间序列的方式呈现,
想要以一个月一个月做为间隔(ex:2016/7 2016/8 2016/9)
这边我试了两个时间序列的函数
1. theta_mean_by_year_ts <- ts(theta_mean_by_year,frequency=12,start = posttim
e[1])
2. theta_mean_by_year_ts <- ts(theta_mean_by_year,frequency=12,start =c(2016-0
7-07))
但最后都无法成功,
形成的图超奇怪,
连x轴都不是日期呈现而是一堆奇怪的数字,
但我明明把他转成日期格式了阿
想请问,
我想要以每个月作为间隔来画图,
然后x轴要正确显示日期该怎么做?
麻烦大家帮帮忙了~~~
https://drive.google.com/open?id=1arfLeV6xGU_dxcYSMGlyjuLYe-V3mP84
程式档和要汇入的档案