library(fredr)
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.
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 (but here we limit to just 10):
fredr_sources(limit = 10)
#> # A tibble: 10 x 5
#> id realtime_start realtime_end name link
#> <int> <chr> <chr> <chr> <chr>
#> 1 1 2021-01-29 2021-01-29 Board of Governors of the… http://www.fede…
#> 2 3 2021-01-29 2021-01-29 Federal Reserve Bank of P… https://www.phi…
#> 3 4 2021-01-29 2021-01-29 Federal Reserve Bank of S… http://www.stlo…
#> 4 6 2021-01-29 2021-01-29 Federal Financial Institu… http://www.ffie…
#> 5 11 2021-01-29 2021-01-29 Dow Jones & Company http://www.dowj…
#> 6 14 2021-01-29 2021-01-29 University of Michigan https://www.umi…
#> 7 15 2021-01-29 2021-01-29 Council of Economic Advis… https://www.whi…
#> 8 16 2021-01-29 2021-01-29 U.S. Office of Management… https://www.whi…
#> 9 17 2021-01-29 2021-01-29 U.S. Congressional Budget… http://www.cbo.…
#> 10 18 2021-01-29 2021-01-29 U.S. Bureau of Economic A… http://www.bea.…
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)
#> # A tibble: 1 x 5
#> id realtime_start realtime_end name link
#> <int> <chr> <chr> <chr> <chr>
#> 1 6 2021-01-29 2021-01-29 Federal Financial Institution… http://www.f…
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
)#> # A tibble: 10 x 7
#> id realtime_start realtime_end name press_release link notes
#> <int> <chr> <chr> <chr> <lgl> <chr> <chr>
#> 1 13 2021-01-29 2021-01-29 G.17 Indu… TRUE http://… <NA>
#> 2 14 2021-01-29 2021-01-29 G.19 Cons… TRUE http://… <NA>
#> 3 15 2021-01-29 2021-01-29 G.5 Forei… TRUE http://… <NA>
#> 4 17 2021-01-29 2021-01-29 H.10 Fore… TRUE http://… <NA>
#> 5 18 2021-01-29 2021-01-29 H.15 Sele… TRUE http://… <NA>
#> 6 19 2021-01-29 2021-01-29 H.3 Aggre… TRUE http://… "The Boa…
#> 7 20 2021-01-29 2021-01-29 H.4.1 Fac… TRUE http://… <NA>
#> 8 21 2021-01-29 2021-01-29 H.6 Money… TRUE http://… <NA>
#> 9 22 2021-01-29 2021-01-29 H.8 Asset… TRUE http://… <NA>
#> 10 52 2021-01-29 2021-01-29 Z.1 Finan… TRUE http://… "The Fin…
To get University of Michigan releases since 1950:
fredr_source_releases(
source_id = 14L,
realtime_start = as.Date("1950-01-01")
)#> # A tibble: 1 x 6
#> id realtime_start realtime_end name press_release link
#> <int> <chr> <chr> <chr> <lgl> <chr>
#> 1 91 1998-07-31 9999-12-31 Surveys of C… TRUE http://www.sca.…