as.yearqtr

How can I create dates in Year/Semester format in R?

╄→гoц情女王★ 提交于 2019-12-07 17:12:10
问题 I want to aggregate zoo data in R by two, four or six months periods. There are only two avaliable options for this type of date processing, using: a) as.yearmon => process daily data grouped by each month b) as.yearqtr => process daily data grouped by fixed groups of 3 months periods (jan-mar, apr-jun, jul-set and oct-dec). A minimal example library(zoo) # creating a vector of Dates dt = as.Date(c("2001-01-01","2001-01-02","2001-04-01","2001-05-01","2001-07-01","2001-10-01"), "%Y-%m-%d") #

How can I create dates in Year/Semester format in R?

余生颓废 提交于 2019-12-06 00:36:01
I want to aggregate zoo data in R by two, four or six months periods. There are only two avaliable options for this type of date processing, using: a) as.yearmon => process daily data grouped by each month b) as.yearqtr => process daily data grouped by fixed groups of 3 months periods (jan-mar, apr-jun, jul-set and oct-dec). A minimal example library(zoo) # creating a vector of Dates dt = as.Date(c("2001-01-01","2001-01-02","2001-04-01","2001-05-01","2001-07-01","2001-10-01"), "%Y-%m-%d") # the original dates dt [1] "2001-01-01" "2001-01-02" "2001-04-01" "2001-05-01" "2001-07-01" "2001-10-01"