README.md

DutchDayDummies

CodeFactor R build
status

The goal of the DutchDayDummies package is to provide functions that can quickly generate regression dummies for official and non-official dutch holidays. It includes virtually all existing (non-official) dutch holidays, varying from Christmas, Easter and Ramadan to Mother’s day, Black Friday and Summer vacation. The functions that create the holiday dummies use algorithms to convert dates to dummies and thus don’t require any input besides the to-be-converted date.

:arrow_double_down: Installation

# Install the cutting edge development version from GitHub:
# install.packages("devtools")
devtools::install_github("Glender/DutchDayDummies")

:book: Usage

Start by creating daily dates that conform to our required format and then run a function like xmas_day:

library(DutchDayDummies)
# create sequence of dates
dates <- seq_days(from="2021-12-24", to="2021-12-27")
# print both results
dates
#> [1] "2021-12-24" "2021-12-25" "2021-12-26" "2021-12-27"
xmas_day(dates)
#> [1] 0 1 0 0

We can gather results of multiple holidays with a tibble dataframe:

library(tibble)
tibble(
  dates = seq_days(from="2021-12-24", to="2022-1-2"),
  xmas = xmas_day(dates),
  boxing = boxing_day(dates),
  nyd = newyears_day(dates),
  nye = newyears_eve(dates)
)
#> # A tibble: 10 x 5
#>    dates       xmas boxing   nyd   nye
#>    <date>     <dbl>  <dbl> <dbl> <dbl>
#>  1 2021-12-24     0      0     0     0
#>  2 2021-12-25     1      0     0     0
#>  3 2021-12-26     0      1     0     0
#>  4 2021-12-27     0      0     0     0
#>  5 2021-12-28     0      0     0     0
#>  6 2021-12-29     0      0     0     0
#>  7 2021-12-30     0      0     0     0
#>  8 2021-12-31     0      0     0     1
#>  9 2022-01-01     0      0     1     0
#> 10 2022-01-02     0      0     0     0

:eyeglasses: Overview

The DutchDayDummies package provides four categories of important functions: official holiday dummies, non-official holidays dummies, vacation dummies, and helper functions.

Functions to create official dutch holiday dummies:

Functions to create non-official dutch holiday dummies:

Functions to create dummies for vacations, or holiday weekends:

Helper functions:

:speech_balloon: Help

The documentation of all functions can be accessed by ?<function-name> or navigate via the package documentation help page ?DutchDayDummies.

# For example:
?ummalqura_algorithm


Glender/DutchDayDummies documentation built on Feb. 24, 2022, 7:15 a.m.