advanceUnits_cpp | R Documentation |
Advance a vector of dates by a given number of time units
advanceUnits_cpp(dates, n, unit, bdc, emr) advanceUnits(dates, n, unit = c("Days", "Weeks", "Months", "Years", "Hours", "Minutes", "Seconds", "Milliseconds", "Microseconds"), bdc = c("Following", "ModifiedFollowing", "Preceding", "ModifiedPreceding", "Unadjusted", "HalfMonthModifiedFollowing", "Nearest"), emr = FALSE)
dates |
A Date vector with dates |
n |
An integer variable with the number of units to advance |
unit |
A character variable describing one of several supported values; the C++ version implements expects a corresponding integer value |
bdc |
A character variable describing one of several supported values, the C++ version implements expects a corresponding integer value |
emr |
A boolean variable select end-of-month, default is ‘FALSE’ |
This function takes a vector of dates and returns another vector of dates of the same length returning at each position the date advanced by the given number of steps in the selected time unit, also respecting a business day convention and and of month boolean switch. Currently supported values for the time unit are ‘Days’, ‘Weeks’, ‘Months’ ‘Years’, ‘Hours’, ‘Seconds’, ‘Milliseconds’ and ‘Microseconds’; all are specified as integers. Note that intra-daily units are not currently supported for advancing ‘Date’ objects. Currently supported values for the business day convention are (starting from zero): ‘Following’, ‘ModifiedFollowing’, ‘Preceding’, ‘ModifiedPreceding’, ‘Unadjusted’, ‘HalfModifiedFollowing’ and ‘Nearest’.
A Date vector with dates advanced according to the selected inputs
advanceUnits(Sys.Date()+0:6, 5, "Days", "Following")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.