I'd like to experiment with some analytics using alternate sampling frequencies. 2 examples are variants on 4 week periods, with periods always ending on Fridays.
z <- as.POSIXlt((as.Date("1900-01-01") + (0:(Sys.Date() - as.Date("1900-01-01")))))
z[z$wday == 5L & z$yday < 363L & z$yday %% 28L <= 6L]) #13, periods, with only the final final period of the year being > 4 weeks
z[z$wday == 5L & z$yday %% 28L <= 6L]) #exactly 4-week periods with periods in a years varying between 13 and 14
While i can calculate the endpoints quite easily, i can't find a way to integrate these into my other calculations and processes, without re-implementing most of the to.period function. Would it be possible to modify the to.period function to take a custom set of endpoints either as a new parameter, or overloading the existing period parameter?
Description
I'd like to experiment with some analytics using alternate sampling frequencies. 2 examples are variants on 4 week periods, with periods always ending on Fridays.
While i can calculate the endpoints quite easily, i can't find a way to integrate these into my other calculations and processes, without re-implementing most of the
to.period
function. Would it be possible to modify theto.period
function to take a custom set of endpoints either as a new parameter, or overloading the existingperiod
parameter?