Learn R Programming

fredr

fredr provides a complete set of R bindings to the Federal Reserve of Economic Data (FRED) RESTful API, provided by the Federal Reserve Bank of St. Louis. The functions allow the user to search for and fetch time series observations as well as associated metadata within the FRED database.

The core function in this package is fredr(), which fetches observations for a FRED series. That said, there are many other FRED endpoints exposed through fredr, such as fredr_series_search_text(), which allows you to search for a FRED series by text.

We strongly encourage referencing the FRED API documentation to leverage the full power of fredr.

You’ll also need a free API key to use fredr. See ?fredr_set_key().

Installation

You can download fredr from CRAN with:

install.packages("fredr")

To get the development version of the package:

# install.packages("devtools")
devtools::install_github("sboysel/fredr")

Example

You can use fredr() to fetch series from FRED. This fetches the US unemployment rate series from 1990-2000.

library(fredr)

fredr(
  series_id = "UNRATE",
  observation_start = as.Date("1990-01-01"),
  observation_end = as.Date("2000-01-01")
)
#> # A tibble: 121 x 5
#>    date       series_id value realtime_start realtime_end
#>    <date>     <chr>     <dbl> <date>         <date>      
#>  1 1990-01-01 UNRATE      5.4 2021-01-29     2021-01-29  
#>  2 1990-02-01 UNRATE      5.3 2021-01-29     2021-01-29  
#>  3 1990-03-01 UNRATE      5.2 2021-01-29     2021-01-29  
#>  4 1990-04-01 UNRATE      5.4 2021-01-29     2021-01-29  
#>  5 1990-05-01 UNRATE      5.4 2021-01-29     2021-01-29  
#>  6 1990-06-01 UNRATE      5.2 2021-01-29     2021-01-29  
#>  7 1990-07-01 UNRATE      5.5 2021-01-29     2021-01-29  
#>  8 1990-08-01 UNRATE      5.7 2021-01-29     2021-01-29  
#>  9 1990-09-01 UNRATE      5.9 2021-01-29     2021-01-29  
#> 10 1990-10-01 UNRATE      5.9 2021-01-29     2021-01-29  
#> # … with 111 more rows

Usage

See the Get started article.

Documentation

See the documentation site.

Restrictions

According to the FRED team, the following data sources do not permit redistribution through the FRED API:

  • ICE Libor Rates
  • ICE Swap Rates
  • LBMA Gold Price: Daily Prices
  • LBMA Silver Price: Daily Prices

If you need data from any of these sources, it is recommended to download the data directly from the FRED website. The series in these sources can be found here.

Code of Conduct

Please note that the fredr project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

See Also

There are several other existing R packages designed for the FRED API:

Copy Link

Version

Install

install.packages('fredr')

Monthly Downloads

4,982

Version

2.1.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Sam Boysel

Last Published

January 29th, 2021

Functions in fredr (2.1.0)

fredr-package

fredr: An R Client for the 'FRED' API
fredr_series_search_tags

Get the FRED tags for a series search.
fredr_series_observations

Get observations of a FRED series
fredr_category_tags

Get the FRED tags for a category
fredr_docs

Open the web documentation for a certain FRED API topic.
fredr_category_related_tags

Get the related FRED tags within a category
fredr_category_series

Get the series in a category
fredr_release

Get a release of economic data
fredr_release_tags

Get the FRED tags for a release
fredr_release_dates

Get release dates for a single release of economic data
fredr_releases

Get all releases of economic data
fredr_category

Get a FRED category
fredr_series

Return basic information for a FRED series.
fredr_category_children

Get the child categories for a specified FRED parent category
fredr_series_categories

Get the categories for a FRED series
fredr_request

Send a request to the FRED API
fredr_releases_dates

Get release dates for all releases of economic data.
fredr_source_releases

Get the releases for a source
fredr_category_related

Get the related categories for a FRED category.
fredr_release_sources

Get the sources for a release of economic data
fredr_release_tables

Get release table trees for a given release
fredr_series_tags

Get the tags for a FRED series
fredr_tags_series

Find FRED series matching tag names
fredr_tags

Get FRED series tags
fredr_release_related_tags

Get the related FRED tags for one or more FRED tags within a release
fredr_release_series

Get the series on a release of economic data
fredr_series_updates

Get a set of recently updated FRED series
fredr_series_search_text

Search for a FRED series.
fredr_series_release

Get the release for a FRED series
fredr_sources

Get all sources of economic data
fredr_source

Get a source of economic data
fredr_series_vintagedates

Get the data vintage dates for a FRED series
fredr-key

FRED API key
fredr_series_search_related_tags

Get the related FRED tags for one or more FRED tags matching a series search
fredr_endpoints

List of available FRED API endpoints.
fredr_related_tags

Get related FRED tags given one or more tags