Skip to contents

This function lets the user automatically scrap holiday dates from any country and year within +- 5 years. Thanks to timeanddate.com!

Usage

holidays(
  countries = "Venezuela",
  years = year(Sys.Date()),
  quiet = FALSE,
  include_regions = FALSE
)

Arguments

countries

Character or vector. For which country(ies) should the holidays be imported?

years

Character or vector. For which year(s) do you wish to import holiday dates?

quiet

Boolean. Default FALSE which disables verbosity of the function.

include_regions

Boolean. Default FALSE. If TRUE, for countries with internal subdivisions, it will provide details on which sub-state the found holidays apply.

Value

data.frame with holidays data for given countries and years.

See also

Other Data Wrangling: balance_data(), categ_reducer(), cleanText(), date_cuts(), date_feats(), file_name(), formatHTML(), impute(), left(), normalize(), num_abbr(), ohe_commas(), ohse(), quants(), removenacols(), replaceall(), replacefactor(), textFeats(), textTokenizer(), vector2text(), year_month(), zerovar()

Other Feature Engineering: date_feats(), ohse()

Other Scrapper: filesGD(), get_mp3(), gtrends_related(), ip_data(), readGS(), splot_summary(), stocks_quote()

Other One Hot Encoding: date_feats(), ohe_commas(), ohse()

Examples

# \donttest{
holidays(countries = "Argentina")
#> >>> Extracting Argentina's holidays for 2024
#> Warning: All formats failed to parse. No formats found.
#> # A tibble: 0 × 10
#> # ℹ 10 variables: holiday <date>, holiday_name <chr>, holiday_type <chr>,
#> #   national <lgl>, observance <lgl>, bank <lgl>, nonwork <lgl>, season <lgl>,
#> #   hother <lgl>, county <fct>
holidays(countries = c("Argentina", "Venezuela"), years = c(2019, 2020))
#> >>> Extracting Argentina's holidays for 2019
#> Warning: All formats failed to parse. No formats found.
#> >>> Extracting Argentina's holidays for 2020
#> Warning: All formats failed to parse. No formats found.
#> >>> Extracting Venezuela's holidays for 2019
#> Warning: All formats failed to parse. No formats found.
#> >>> Extracting Venezuela's holidays for 2020
#> Warning: All formats failed to parse. No formats found.
#> # A tibble: 0 × 11
#> # ℹ 11 variables: holiday <date>, holiday_name <chr>, holiday_type <chr>,
#> #   national <lgl>, observance <lgl>, bank <lgl>, nonwork <lgl>, season <lgl>,
#> #   hother <lgl>, country <fct>, county <fct>
holidays(countries = "Germany", years = 2021:2023, include_regions = TRUE)
#> >>> Extracting Germany's holidays for 2021
#> Warning: All formats failed to parse. No formats found.
#> >>> Extracting Germany's holidays for 2022
#> Warning: All formats failed to parse. No formats found.
#> >>> Extracting Germany's holidays for 2023
#> Warning: All formats failed to parse. No formats found.
#> # A tibble: 0 × 11
#> # ℹ 11 variables: holiday <date>, holiday_name <chr>, holiday_type <chr>,
#> #   holiday_details <chr>, national <lgl>, observance <lgl>, bank <lgl>,
#> #   nonwork <lgl>, season <lgl>, hother <lgl>, county <fct>
# }