I need to take a vector of dates and for each date get the first day of the next quarter.
(Rather, round to the last day of the current quarter, find the first day of the next quarter and remove my plan from it)
lubridate will be round / ceiling up to several months but not quarters
The only solution I have found so far is to make a vector listing all the quarterly beginnings from 1970 to 2099, and then search it to find the minimum date after my date. It is clear that this greatly distorts and scales.
I need to indicate the year of the end of the year (although the year always starts on the 1st of the month)
eg.
x = as.Date("2014-08-15") RoundToQuarterStart(x, yearStarts = "March") [1] "2014-09-01"
From the moment the year begins on March 1 in this example, Q3 starts on September 1, which begins in the next quarter after the specified date. (or, which is the same, this date refers to Q2, which ends on August 31)
date r rounding
Corone
source share