Rollback of Months
Generating regular sequences of times with the help of
seq.POSIXt
can have undesirable effects. This function
“first advances the month without changing the day: if this results
in an invalid day of the month, it is counted forward into the next month”.
Monthly or yearly sequences starting at the end of a month with 30 or 31
days (or 29 in case of a leap year) therefore do not always fall on the end
of shorter months. rollback
reverts this process by counting the days
backwards again.
rollback(.dateTime, periodicity)
.dateTime |
A |
periodicity |
A character string specifying a multiple of month(s) or
year(s). See |
Returns a POSIXct
vector.
# rollback monthly time series by <- "1 month" rollback( .dateTime = seq( from = as.POSIXct("2000-01-31", tz = "UTC"), to = as.POSIXct("2000-12-31", tz = "UTC"), by = by ), periodicity = by )
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.