is.workday: Test for working days

Description Usage Arguments Value Examples

Description

Test for dates of working days, with options to define weekends and whether to exclude public holiday off-in-lieu.

Usage

1
is.workday(date, oil = T, weekend = c("Sat", "Sun"))

Arguments

date

A date vector to be tested.

oil

Logical. Default TRUE will account for public holiday off-in-lieu.

weekend

Vector of days to define weekend. Default include Sat and Sun.

Value

A logical vector indicating working day or not.

Examples

1
2
3
4
5
6
7
library(dplyr)
library(lubridate)
library(sgholidays)
data.frame(cal = seq.Date(ymd(20130101), ymd(20130401), 1) ) %>%
  dplyr::mutate(day = lubridate::wday(cal, TRUE)) %>% 
  mutate(is_ph = is.ph(cal, TRUE)) %>% 
  mutate(is_workday = is.workday(cal, TRUE))

tselert/sgholidays documentation built on Dec. 23, 2021, 12:57 p.m.