business_days | R Documentation |
Check whether a timestamp of class Date
or
POSIXt
is a business day; compute past or future
business days.
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)
x |
a vector of class |
holidays |
A vector of class |
shift |
integer |
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
.
Logical.
Enrico Schumann
B.D. Ripley and K. Hornik. Date-Time Classes. R-News, 1(2):8–12, 2001.
DateTimeClasses
is_weekend(Sys.Date())
previous_businessday(Sys.Date())
next_businessday(Sys.Date())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.