View source: R/download_data_fred.R
| download_data_fred | R Documentation |
Downloads a specified data series from the Federal Reserve Economic Data (FRED) website, processes the data, and returns it as a tibble.
download_data_fred(series, start_date = NULL, end_date = NULL)
series |
A character vector specifying the FRED series ID(s) to download. |
start_date |
Optional. A character string or Date object in "YYYY-MM-DD" format specifying the start date for the data. If not provided, the full dataset is returned. |
end_date |
Optional. A character string or Date object in "YYYY-MM-DD" format specifying the end date for the data. If not provided, the full dataset is returned. |
Constructs the URL based on the provided FRED series ID, performs an HTTP GET request to download the data in CSV format, and processes it to a tidy tibble format. The resulting tibble includes the date, value, and the series ID.
This approach is inspired by quantmod::getSymbolsFRED() which uses a
different wrapper around the same FRED download data site. If you want to
systematically download FRED data via API, please consider using the fredr
package.
A tibble containing the processed data with three columns:
The date corresponding to the data point.
The value of the data series at that date.
The FRED series ID corresponding to the data.
Other download functions:
download_data(),
download_data_constituents(),
download_data_factors_ff(),
download_data_factors_q(),
download_data_huggingface(),
download_data_macro_predictors(),
download_data_osap(),
download_data_risk_free(),
download_data_stock_prices(),
download_factor_library_grid(),
download_factor_library_ids()
download_data_fred("CPIAUCNS")
download_data_fred(c("GDP", "CPIAUCNS"), "2010-01-01", "2010-12-31")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.