Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/67.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中使用yyyyQQ因子时间变量对季度数据进行子集_R_Time Series_Subset - Fatal编程技术网

在R中使用yyyyQQ因子时间变量对季度数据进行子集

在R中使用yyyyQQ因子时间变量对季度数据进行子集,r,time-series,subset,R,Time Series,Subset,我试图在季度时间变量上用大于号的符号对欧盟统计局数据进行子集划分: install.packages("SmarterPoland") library(SmarterPoland) GDP <- getEurostatRCV(kod = "namq_gdp_c") install.packages(“SmarterPland”) 图书馆(智能乐园) GDP“1989”),但对于季度数据,我猜R不理解“时间”是一个上升变量。我得到这个错误: 警告信

我试图在季度时间变量上用大于号的符号对欧盟统计局数据进行子集划分:

install.packages("SmarterPoland")
library(SmarterPoland)

GDP <- getEurostatRCV(kod = "namq_gdp_c")
install.packages(“SmarterPland”)
图书馆(智能乐园)
GDP“1989”),但对于季度数据,我猜R不理解“时间”是一个上升变量。我得到这个错误:

警告信息:

在运算因子(时间,“1989Q4”):>对于因子没有意义

任何帮助都会很好:-)


编辑:允许创建标记“季度”或“季度数据”的人可以吗?可能有助于google…

zoo
软件包中使用
yearqtr
类:

install.packages("zoo")
library(zoo)
> as.yearqtr("1989Q3") < as.yearqtr("1989Q4")
[1] TRUE

我认为没有必要为季度数据创建标签,因为它属于“时间序列”类别,但我确实在您的帖子中添加了该标签。

非常感谢!使用该子集后,效果非常好!
install.packages("zoo")
library(zoo)
> as.yearqtr("1989Q3") < as.yearqtr("1989Q4")
[1] TRUE
GDP$time = as.yearqtr(GDP$time)