Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/reporting-services/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
获取在R中plot.stl方法的x轴上显示的日期_R - Fatal编程技术网

获取在R中plot.stl方法的x轴上显示的日期

获取在R中plot.stl方法的x轴上显示的日期,r,R,我想知道是否有人知道如何让日期显示在stl绘图的x轴上 res<- (stl(ts(data[,variable],frequency=52,start=as.Date(data[1,date]) ),s.window="per",robust=TRUE) ) plot(res) 问题在于如何创建时间序列对象。 ?ts会给你 开始:第一次观察的时间单个数字或单个数字 两个整数的向量,指定自然时间单位和 (1)时间单位中的样本数 由于您的数据从2007-01-01开始,并且是每周数据,

我想知道是否有人知道如何让日期显示在stl绘图的x轴上

 res<- (stl(ts(data[,variable],frequency=52,start=as.Date(data[1,date]) ),s.window="per",robust=TRUE) ) 
plot(res)

问题在于如何创建时间序列对象。 ?ts会给你

开始:第一次观察的时间单个数字或单个数字 两个整数的向量,指定自然时间单位和 (1)时间单位中的样本数

由于您的数据从2007-01-01开始,并且是每周数据,因此必须指定c(2007,1),请注意,此处的“1”表示数据从2007年第一周开始,因为数据是每周的。在这里,频率应设置为52,因为在52个周期/周之后,一年将从2007年更改为2008年

这应该行得通

res<- (stl(ts(data[,2],frequency=52,start=c(2007,1 )),s.window="per",robust=TRUE) )
res
res<- (stl(ts(data[,2],frequency=52,start=c(2007,1 )),s.window="per",robust=TRUE) )