download_data_fred: Download and Process Data from FRED

View source: R/download_data_fred.R

download_data_fredR Documentation

Download and Process Data from FRED

Description

Downloads a specified data series from the Federal Reserve Economic Data (FRED) website, processes the data, and returns it as a tibble.

Usage

download_data_fred(series, start_date = NULL, end_date = NULL)

Arguments

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.

Details

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.

Value

A tibble containing the processed data with three columns:

date

The date corresponding to the data point.

value

The value of the data series at that date.

series

The FRED series ID corresponding to the data.

See Also

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()

Examples


  download_data_fred("CPIAUCNS")
  download_data_fred(c("GDP", "CPIAUCNS"), "2010-01-01", "2010-12-31")



tidyfinance documentation built on June 1, 2026, 1:06 a.m.