How to split in R a date range into quarterly basis period? -
i want split monthly date range quarterly basis period. date variable built as.yearmonth:
> data$dates jul. 2014 ago. 2014 sep. 2014 ... ... jun. 2016 jul. 2016 ago. 2016 sep. 2016
how should it? cut function works dates? don't want manually.
lubridate has quarter function. check out:
library(lubridate) x <- ymd(c("2012-03-26", "2012-05-04", "2012-09-23", "2012-12-31")) quarter(x) quarter(x, with_year = true)
then thing have sort out date formats understood.
Comments
Post a Comment