Introduction

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

FRED series are the primary data objects in the FRED database. Each FRED series is assigned a string identifier. For example:

  • Civilian Unemployment Rate (series_id = "UNRATE")
  • Real Gross National Product (series_id = "GNPCA")
  • Effective Federal Funds Rate (series_id = "FEDFUNDS")

FRED series are assigned categories and tags attributes for organization and classification. The following examples illustrate usage of the Series endpoint functions in fredr.

Retrieve observations

The function fredr(), an alias for fredr_series_observations(), is the core function in fredr for fetching FRED data series. See the Get started article and ?fredr() for many usage examples.

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

Search for FRED series

Use fredr_series_search_text() to search for a series by text in the series description. The data returned is a tibble where each row represents series with description text that matches the text specified by search_text. For example, to search for series with description text that matches “UNRATE”:

fredr_series_search_text(
  search_text = "unemployment",
  limit = 100L
)
#> # A tibble: 100 x 16
#>    id     realtime_start realtime_end title     observation_sta… observation_end
#>    <chr>  <chr>          <chr>        <chr>     <chr>            <chr>          
#>  1 UNRATE 2021-04-05     2021-04-05   Unemploy… 1948-01-01       2021-03-01     
#>  2 UNRAT… 2021-04-05     2021-04-05   Unemploy… 1948-01-01       2021-03-01     
#>  3 NROU   2021-04-05     2021-04-05   Natural … 1949-01-01       2031-10-01     
#>  4 UNEMP… 2021-04-05     2021-04-05   Unemploy… 1948-01-01       2021-03-01     
#>  5 CCSA   2021-04-05     2021-04-05   Continue… 1967-01-07       2021-03-20     
#>  6 LNS14… 2021-04-05     2021-04-05   Unemploy… 1972-01-01       2021-03-01     
#>  7 CCNSA  2021-04-05     2021-04-05   Continue… 1967-01-07       2021-03-20     
#>  8 LNS14… 2021-04-05     2021-04-05   Unemploy… 1972-01-01       2021-03-01     
#>  9 LNU04… 2021-04-05     2021-04-05   Unemploy… 1972-01-01       2021-03-01     
#> 10 U6RATE 2021-04-05     2021-04-05   Total Un… 1994-01-01       2021-03-01     
#> # … with 90 more rows, and 10 more variables: frequency <chr>,
#> #   frequency_short <chr>, units <chr>, units_short <chr>,
#> #   seasonal_adjustment <chr>, seasonal_adjustment_short <chr>,
#> #   last_updated <chr>, popularity <int>, group_popularity <int>, notes <chr>

Use fredr_series_search_id() to search for a series by character ID of the series. The data returned is a tibble where each row represents series with an ID that matches the text specified by search_text. For example, to search for series with an ID that matches "UNRATE":

fredr_series_search_id(
  search_text = "UNRATE",
  limit = 100L
)
#> # A tibble: 16 x 16
#>    id     realtime_start realtime_end title     observation_sta… observation_end
#>    <chr>  <chr>          <chr>        <chr>     <chr>            <chr>          
#>  1 UNRATE 2021-04-05     2021-04-05   Unemploy… 1948-01-01       2021-03-01     
#>  2 UNRAT… 2021-04-05     2021-04-05   FOMC Sum… 2021-01-01       2023-01-01     
#>  3 UNRAT… 2021-04-05     2021-04-05   Longer R… 2009-02-18       2021-03-17     
#>  4 UNRAT… 2021-04-05     2021-04-05   FOMC Sum… 2021-01-01       2023-01-01     
#>  5 UNRAT… 2021-04-05     2021-04-05   Longer R… 2009-02-18       2021-03-17     
#>  6 UNRAT… 2021-04-05     2021-04-05   FOMC Sum… 2021-01-01       2023-01-01     
#>  7 UNRAT… 2021-04-05     2021-04-05   Longer R… 2009-02-18       2021-03-17     
#>  8 UNRAT… 2021-04-05     2021-04-05   FOMC Sum… 2021-01-01       2023-01-01     
#>  9 UNRAT… 2021-04-05     2021-04-05   Longer R… 2015-06-17       2021-03-17     
#> 10 UNRAT… 2021-04-05     2021-04-05   Unemploy… 1948-01-01       2021-03-01     
#> 11 UNRAT… 2021-04-05     2021-04-05   FOMC Sum… 2021-01-01       2023-01-01     
#> 12 UNRAT… 2021-04-05     2021-04-05   Longer R… 2009-02-18       2021-03-17     
#> 13 UNRAT… 2021-04-05     2021-04-05   FOMC Sum… 2021-01-01       2023-01-01     
#> 14 UNRAT… 2021-04-05     2021-04-05   Longer R… 2009-02-18       2021-03-17     
#> 15 UNRAT… 2021-04-05     2021-04-05   FOMC Sum… 2021-01-01       2023-01-01     
#> 16 UNRAT… 2021-04-05     2021-04-05   Longer R… 2009-02-18       2021-03-17     
#> # … with 10 more variables: frequency <chr>, frequency_short <chr>,
#> #   units <chr>, units_short <chr>, seasonal_adjustment <chr>,
#> #   seasonal_adjustment_short <chr>, last_updated <chr>, popularity <int>,
#> #   group_popularity <int>, notes <chr>

Search for FRED series by tags

Use fredr_series_search_tags() to search for series tags. The data returned is a tibble where each row represents a tag matching the text in series_search_text. For example, to return the top 100 tags (by series count) matching the text "unemployment":

fredr_series_search_tags(
  series_search_text = "unemployment",
  limit = 100L
)
#> # A tibble: 100 x 6
#>    name           group_id notes             created     popularity series_count
#>    <chr>          <chr>    <chr>             <chr>            <int>        <int>
#>  1 nsa            seas     "Not Seasonally … 2012-02-27…        100        44598
#>  2 usa            geo      "United States o… 2012-02-27…        100        40164
#>  3 public domain… cc        <NA>             2018-12-17…        100        39872
#>  4 bls            src      "Bureau of Labor… 2012-02-27…         87        35950
#>  5 unemployment   gen      ""                2012-02-27…         78        32434
#>  6 county         geot     "County or Count… 2012-02-27…         80        28244
#>  7 annual         freq     ""                2012-02-27…         90        22144
#>  8 household sur… gen      "Current Populat… 2012-06-18…         65        19936
#>  9 monthly        freq     ""                2012-02-27…         93        18890
#> 10 rate           gen      ""                2012-02-27…         87        14648
#> # … with 90 more rows

Get basic information for a FRED series

The fredr_series() function returns information for a single series specified by series_id. The data returned is a tibble in which each row represents the series specified. For example, to get information for the UNRATE series:

fredr_series(series_id = "UNRATE")
#> # A tibble: 1 x 15
#>   id     realtime_start realtime_end title      observation_sta… observation_end
#>   <chr>  <chr>          <chr>        <chr>      <chr>            <chr>          
#> 1 UNRATE 2021-04-05     2021-04-05   Unemploym… 1948-01-01       2021-03-01     
#> # … with 9 more variables: frequency <chr>, frequency_short <chr>, units <chr>,
#> #   units_short <chr>, seasonal_adjustment <chr>,
#> #   seasonal_adjustment_short <chr>, last_updated <chr>, popularity <int>,
#> #   notes <chr>

Note that there may potentially be more than one row returned if the series has been revised and real time periods are adjusted:

fredr_series(
  series_id = "UNRATE",
  realtime_start = as.Date("1950-01-01")
)
#> # A tibble: 4 x 15
#>   id     realtime_start realtime_end title      observation_sta… observation_end
#>   <chr>  <chr>          <chr>        <chr>      <chr>            <chr>          
#> 1 UNRATE 1960-03-15     1967-02-08   Civilian … 1948-01-01       1966-12-01     
#> 2 UNRATE 1967-02-09     2012-02-02   Civilian … 1948-01-01       2011-12-01     
#> 3 UNRATE 2012-02-03     2019-09-05   Civilian … 1948-01-01       2019-07-01     
#> 4 UNRATE 2019-09-06     9999-12-31   Unemploym… 1948-01-01       2021-03-01     
#> # … with 9 more variables: frequency <chr>, frequency_short <chr>, units <chr>,
#> #   units_short <chr>, seasonal_adjustment <chr>,
#> #   seasonal_adjustment_short <chr>, last_updated <chr>, popularity <int>,
#> #   notes <chr>

Get the categories for a FRED series

The fredr_series_categories() function returns a list of categories for the series specified by series_id. The data returned is a tibble in which each row represents a category that the series belongs to. For example, to get the categories for the UNRATE series:

fredr_series_categories(series_id = "UNRATE")
#> # A tibble: 1 x 4
#>      id name          parent_id notes                                           
#>   <int> <chr>             <int> <chr>                                           
#> 1 32447 Unemployment…        12 The ratio of unemployed to the civilian labor f…

Get the release for a FRED series

The fredr_series_release() function returns a list of releases that the series specified by series_id belongs to. The data returned is a tibble in which each row represents a release that the series belongs to. For example, to get the release for the UNRATE series:

fredr_series_release(series_id = "UNRATE")
#> # A tibble: 1 x 6
#>      id realtime_start realtime_end name           press_release link           
#>   <int> <chr>          <chr>        <chr>          <lgl>         <chr>          
#> 1    50 2021-04-05     2021-04-05   Employment Si… TRUE          http://www.bls…

Get the tags for a FRED series

The fredr_series_tags() function returns a list of tags that are assigned to the series specified by series_id. The data returned is a tibble in which each row represents a tag assigned to the series. For example, to get the tags for the UNRATE series:

fredr_series_tags(
  series_id = "UNRATE",
  order_by = "name"
)
#> # A tibble: 14 x 6
#>    name           group_id notes             created     popularity series_count
#>    <chr>          <chr>    <chr>             <chr>            <int>        <int>
#>  1 16 years +     gen      ""                2012-02-27…         59         5832
#>  2 bls            src      "Bureau of Labor… 2012-02-27…         87       156172
#>  3 civilian       gen      ""                2012-02-27…         55         9622
#>  4 headline figu… gen      ""                2013-11-19…         53           60
#>  5 household sur… gen      "Current Populat… 2012-06-18…         65        21436
#>  6 labor          gen      ""                2012-02-27…         61        30242
#>  7 labor underut… gen      ""                2012-05-10…         37          700
#>  8 monthly        freq     ""                2012-02-27…         93       212816
#>  9 nation         geot     ""                2012-02-27…         99       238588
#> 10 public domain… cc        <NA>             2018-12-17…        100       578958
#> 11 rate           gen      ""                2012-02-27…         87        47026
#> 12 sa             seas     "Seasonally Adju… 2012-02-27…         88        81174
#> 13 unemployment   gen      ""                2012-02-27…         78        32394
#> 14 usa            geo      "United States o… 2012-02-27…        100       627780

Get a set of recently updated FRED series

The fredr_series_updates() function returns a list of series recently updated on the FRED server. The data returned is a tibble in which each row represents a series. For example, the default call simply lists 1000 recent updates (the default for the limit parameter), most recent updates appearing first (but here we limit to 10):

fredr_series_updates(limit = 10L)
#> # A tibble: 10 x 15
#>    id     realtime_start realtime_end title     observation_sta… observation_end
#>    <chr>  <chr>          <chr>        <chr>     <chr>            <chr>          
#>  1 WILLS… 2021-04-05     2021-04-05   Wilshire… 1991-12-31       2021-04-01     
#>  2 WILLS… 2021-04-05     2021-04-05   Wilshire… 1991-12-31       2021-04-01     
#>  3 WILLS… 2021-04-05     2021-04-05   Wilshire… 1991-12-31       2021-04-01     
#>  4 WILLM… 2021-04-05     2021-04-05   Wilshire… 1991-12-31       2021-04-01     
#>  5 WILLR… 2021-04-05     2021-04-05   Wilshire… 1977-12-30       2021-04-01     
#>  6 WILLM… 2021-04-05     2021-04-05   Wilshire… 1991-12-31       2021-04-01     
#>  7 WILLM… 2021-04-05     2021-04-05   Wilshire… 1991-12-31       2021-04-01     
#>  8 WILLM… 2021-04-05     2021-04-05   Wilshire… 1991-12-31       2021-04-01     
#>  9 WILLL… 2021-04-05     2021-04-05   Wilshire… 1991-12-31       2021-04-01     
#> 10 WILLL… 2021-04-05     2021-04-05   Wilshire… 1991-12-31       2021-04-01     
#> # … with 9 more variables: frequency <chr>, frequency_short <chr>, units <chr>,
#> #   units_short <chr>, seasonal_adjustment <chr>,
#> #   seasonal_adjustment_short <chr>, last_updated <chr>, popularity <int>,
#> #   notes <chr>

Use the start_time and end_time parameters to filter the results by time. For example, to get all the macroeconomic times series updated in the last day:

fredr_series_updates(
  start_time = Sys.time() - 60 * 60 * 24,
  end_time = Sys.time(),
  filter_value = "macro",
  limit = 10L
)
#> # A tibble: 10 x 15
#>    id     realtime_start realtime_end title     observation_sta… observation_end
#>    <chr>  <chr>          <chr>        <chr>     <chr>            <chr>          
#>  1 WILLS… 2021-04-05     2021-04-05   Wilshire… 1991-12-31       2021-04-01     
#>  2 WILLS… 2021-04-05     2021-04-05   Wilshire… 1991-12-31       2021-04-01     
#>  3 WILLS… 2021-04-05     2021-04-05   Wilshire… 1991-12-31       2021-04-01     
#>  4 WILLM… 2021-04-05     2021-04-05   Wilshire… 1991-12-31       2021-04-01     
#>  5 WILLR… 2021-04-05     2021-04-05   Wilshire… 1977-12-30       2021-04-01     
#>  6 WILLM… 2021-04-05     2021-04-05   Wilshire… 1991-12-31       2021-04-01     
#>  7 WILLM… 2021-04-05     2021-04-05   Wilshire… 1991-12-31       2021-04-01     
#>  8 WILLM… 2021-04-05     2021-04-05   Wilshire… 1991-12-31       2021-04-01     
#>  9 WILL2… 2021-04-05     2021-04-05   Wilshire… 1991-12-31       2021-04-01     
#> 10 WILLL… 2021-04-05     2021-04-05   Wilshire… 1991-12-31       2021-04-01     
#> # … with 9 more variables: frequency <chr>, frequency_short <chr>, units <chr>,
#> #   units_short <chr>, seasonal_adjustment <chr>,
#> #   seasonal_adjustment_short <chr>, last_updated <chr>, popularity <int>,
#> #   notes <chr>

Get the vintage dates for a FRED series

The fredr_series_vintagedates() function returns a sequence of dates in history when the series specified by series_id was revised or appended to. The data returned is a tibble where each row is a date. For example, to get the vintage dates for the series UNRATE:

fredr_series_vintagedates(series_id = "UNRATE")
#> # A tibble: 734 x 1
#>    vintage_dates
#>    <chr>        
#>  1 1960-03-15   
#>  2 1960-04-12   
#>  3 1960-05-11   
#>  4 1960-06-13   
#>  5 1960-07-12   
#>  6 1960-08-10   
#>  7 1960-09-09   
#>  8 1960-10-10   
#>  9 1960-11-10   
#> 10 1960-12-12   
#> # … with 724 more rows