FRED Sources

knitr::opts_chunk$set(
  fig.width = 7,
  fig.height = 5,
  eval = !(Sys.getenv("FRED_API_KEY") == ""),
  cache = TRUE,
  collapse = TRUE,
  comment = "#>"
)
library(fredr)
options(digits = 4)

Introduction

This vignette is intended to introduce the user to fredr functions for the Sources endpoint of the FRED API.

FRED series are derived from a specific data source. Each FRED source is assigned an integer identifier. The following examples illustrate usage of the Sources endpoint functions in fredr.

Get FRED sources

The function fredr_sources() returns a list of FRED data sources. The information returned is a tibble in which each row represents a FRED source. For example, running fredr_sources() without any arguments returns the first 1000 (limit default) sources ordered by ascending source ID:

fredr_sources()

Get a single FRED source

The function fredr_source() returns information for a single source indicated by source_id. The data returned is a tibble in which each row represents a FRED source. For example, the Federal Financial Institutions Examination Council source ID is 6:

fredr_source(source_id = 6L)

Get FRED releases for a source

The function fredr_source_releases() returns FRED release information for the source indicated by source_id. As with the functions for the Releases endpoint, the data returned is a tibble in which each row represents a FRED release for the specified source. For example, to get the first 10 releases from the Federal Reserve Board of Governors, ordered by ascending release ID:

fredr_source_releases(
  source_id = 1L,
  limit = 10L
)

To get University of Michigan releases since 1950:

fredr_source_releases(
  source_id = 14L,
  realtime_start = as.Date("1950-01-01")
)


Try the fredr package in your browser

Any scripts or data that you put into this service are public.

fredr documentation built on May 2, 2019, 7:29 a.m.