rollback | R Documentation |
Generating regular sequences of time 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
fixes
this by counting the days of affected months 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
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.