get_holidays: Get holidays from the Canada Holidays API

View source: R/get_holidays.R

get_holidaysR Documentation

Get holidays from the Canada Holidays API

Description

Get all holidays for a given year. Best used for obtaining a list of federal holidays.

Usage

get_holidays(year = NULL, federal = NULL, optional = NULL)

Arguments

year

The year for which holidays should be retrieved, between 2013 and 2038. The default, NULL, is equivalent to the current year.

federal

A boolean indicating whether only federal holidays should be retrieved. The default, NULL, is equivalent to FALSE.

optional

A boolean indicating whether optional (non-legislated) holidays should be retrieved. The default, NULL, is equivalent to FALSE.

Value

A tibble with columns:

date

⁠<date>⁠ The date when the holiday occurs.

observed_date

⁠<date>⁠ The date when the holiday is observed (celebrated). For example, if Christmas Day falls on a Sunday, it is observed (celebrated) on the proceeding Monday.

name_en

⁠<chr>⁠ The name of the holiday, in English.

name_fr

⁠<chr>⁠ The name of the holiday, in French.

federal

⁠<lgl>⁠ Whether the holiday is a federal holiday.

holiday_id

⁠<int>⁠ The id of the holiday.

provinces

⁠<list>⁠ A list of tibbles containing information on the provinces observing the holiday and source links.

See Also

get_province(), Canada Holidays API

Examples

if (interactive()) {
  get_holidays()
}

holideh documentation built on April 9, 2026, 5:09 p.m.