View source: R/geom_recessions.R
update_recessions | R Documentation |
The cmapplot package contains an internal dataset recessions
of all
recessions in American history as recorded by the National Bureau of Economic
Research (NBER). However, users may need to replace the built-in data, such as
in the event of new recessions and/or changes to the NBER consensus on
recession dates. This function fetches and interprets this data from the NBER
website.
update_recessions(url = NULL, quietly = FALSE)
url |
Char, the web location of the NBER machine-readable CSV file. The
default, |
quietly |
Logical, suppresses messages produced by
|
A data frame with the following variables:
start_char, end_char
: Chr. Easily readable labels for the beginning
and end of the recession.
start_date, end_date
: Date. Dates
expressed in R datetime format, using the first day of the specified month.
ongoing
: Logical. Whether or not the recession is ongoing as of
the latest available NBER data.
https://www.nber.org/data/cycles/cycle dates pasted.csv
recessions <- update_recessions()
# package maintainers can update the internal dataset from within
# package by running the following code:
## Not run:
recessions <- update_recessions()
usethis::use_data(recessions, internal = TRUE, overwrite = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.