Learn R Programming

lares (version 5.4.1)

holidays: Holidays in your Country

Description

This function lets the user automatically retrieve public holiday dates for any country supported by the Nager.Date API. Accepts country names (e.g., "Portugal") or ISO 3166-1 alpha-2 codes (e.g., "PT"). Thanks to Nager.Date!

Usage

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

Value

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

Arguments

countries

Character or vector. For which country(ies) should the holidays be imported? Accepts country names or ISO 3166-1 alpha-2 codes.

years

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

quiet

Boolean. Keep quiet? If not, informative messages will be shown.

include_regions

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

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(), gtrends_related(), ip_data(), mp3_get(), readGS(), splot_summary(), stocks_quote()

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

Examples

Run this code
# \donttest{
holidays(countries = "Argentina")
year <- as.integer(format(Sys.Date(), format = "%Y"))
holidays(countries = c("Spain", "Venezuela"), years = year)
holidays(countries = "Germany", include_regions = TRUE)
holidays(countries = "PT") # Also accepts ISO country codes
# }

Run the code above in your browser using DataLab