Description Usage Arguments Details See Also Examples
Bunch of convenience functions to do simple arithmetic on dates.
1 2 3 4 5 6 7 8 9 10 11 | addDays(date, n = 1)
subtractDays(date, n = 1)
addBizDays(date, n = 1, hol = NULL)
subtractBizDays(date, n = 1, hol = NULL)
addMonths(date, n = 1)
subtractMonths(date, n = 1)
|
date |
A 'datelike' object |
n |
An integer number of days/months to add/subtract (default 1) |
hol |
A 'datelike' object containing holiday dates |
Increment or decrement the vector 'date' forward or backward by 'n' day(s), 'n' business day(s), or 'n' months. Business days are considered to be Monday through Friday. A vector of holiday dates can be passed in.
is.DateLike
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## Not run:
x <- seq(from=as.Date("2001-01-01"), to=as.Date("2001-01-31"), by="day")
ax <- addDays(x, 3)
difftime(x, ax)
x <- seq(from=as.Date("2001-01-01"), to=as.Date("2001-01-31"), by="day")
sx <- subtractDays(x, 3)
difftime(x, sx)
x <- seq(from=as.Date("2001-01-01"), to=as.Date("2002-06-01"), by="months")
h <- as.Date("2001-07-02")
ax <- addBizDays(x, hol=h)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.