How can I create dates in Year/Semester format in R?
问题 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") #