business_days {datetimeutils} | R Documentation |
Business Days
Description
Check whether a timestamp of class Date
or
POSIXt
is a business day; compute past or future
business days.
Usage
is_businessday(x, holidays = NULL)
is_weekend(x)
previous_businessday(x, holidays = NULL, shift = -1)
prev_bday(x, holidays = NULL, shift = -1)
next_businessday(x, holidays = NULL, shift = 1)
next_bday(x, holidays = NULL, shift = 1)
Arguments
x |
a vector of class |
holidays |
A vector of class |
shift |
integer |
Details
is_weekend
checks whether a given date is a Saturday or Sunday.
previous_businessday
takes a Date
x
and
returns the last non-weekend day before. When shift
is less
than -1, the function evaluates to the shift
-th previous
day. When shift
is 0, the function will return x
if it
is a business day, else the previous business
day. next_businessday
works analogously. There are shorter-named
versions next_bday
and prev_bday
.
Value
Logical.
Author(s)
Enrico Schumann
References
B.D. Ripley and K. Hornik. Date-Time Classes. R-News, 1(2):8–12, 2001.
See Also
Examples
is_weekend(Sys.Date())
previous_businessday(Sys.Date())
next_businessday(Sys.Date())