check_dayoffs: Check if the day is an official day off

View source: R/check_dayoffs.R

check_dayoffsR Documentation

Check if the day is an official day off

Description

Check any date or date vector for is an official day off or not.

Usage

check_dayoffs(date  = NULL,
              year  = NULL,
              month = NULL,
              day   = NULL,
              cc    = getOption("timeperiodsR.official_day_offs_country"),
              pre   = getOption("timeperiodsR.official_day_offs_pre"),
              include_custom_day_offs = TRUE)

Arguments

year

Year for check

month

Month for check

day

Month for check.

date

Date, or date vector for checking

cc

Country, one of ru, ua, kz, by

pre

Including shorter working days, 0 or 1

include_custom_day_offs

Including custom dayoffs from options or global variables

Details

Function use 'isDayOff() API'.

For get official day offs for your country you must install httr package and switch options timeperiodsR.official_day_offs to TRUE or set system variable TPR_DAY_OFFS=TRUE.

Now allow next country:

ru

Russia

ua

Ukraine

kz

Kazakhstan

by

Belarus

Also you can set default country by options or systen envarible:

option

timeperiodsR.official_day_offs_country

system variable

TPR_COUNTRY

And you can include or exclude shorter working days. Using option timeperiodsR.official_day_offs_pre:

0

Exclude shorter work days

1

Include shorter work days

Day marks:

0

Workday

1

Day off

2

Shorten day off

3

Custom day off

You can set your custom day offs, for example it can be your vacation. Using option timeperiodsR.custom_day_offs or system variable TPR_CUSTOM_DAY_OFFS. In TPR_CUSTOM_DAY_OFFS you can set custom day offs like comma or semicolon list of dates in format YYYY-MM-DD.

Value

Named vector with date and marks

Author(s)

Alexey Seleznev

References

Official documentation for isDayOff API

Examples

ld <- next_n_weeks(n = 2)
check_dayoffs(date = ld)

selesnow/timeperiodsR documentation built on Jan. 27, 2024, 7:32 a.m.