Search FRED for a series by full text of series or by series ID.

fredr_series_search_text(
  search_text,
  ...,
  tag_names = NULL,
  exclude_tag_names = NULL,
  filter_variable = NULL,
  filter_value = NULL,
  limit = NULL,
  offset = NULL,
  order_by = NULL,
  sort_order = NULL,
  realtime_start = NULL,
  realtime_end = NULL
)

fredr_series_search_id(
  search_text,
  ...,
  limit = 1000L,
  offset = 0,
  order_by = NULL,
  sort_order = "asc",
  filter_variable = NULL,
  filter_value = NULL,
  realtime_start = NULL,
  realtime_end = NULL,
  tag_names = NULL,
  exclude_tag_names = NULL
)

Arguments

search_text

A string containing the words to match against economic data series. For use with fredr_series_search_text and fredr_series_search_id.

...

These dots only exist for future extensions and should be empty.

tag_names

A semicolon delimited string of tag names that series match all of. Defaults to no tag filtering.

exclude_tag_names

A semicolon delimited string of tag names that series match none of. Defaults to no tag filtering.

filter_variable

A string indicating the attribute to filter results by. Possible values are: "frequency", "units", "seasonal_adjustment". Defaults to no filter.

filter_value

The value of the filter_variable attribute to filter by. Possible values depend on the value of filter_variable. Defaults to no filter.

limit

An integer limit on the maximum number of results to return. Defaults to 1000, the maximum.

offset

An integer used in conjunction with limit for long series. This mimics the idea of pagination to retrieve large amounts of data over multiple calls. Defaults to 0.

order_by

A string indicating the attribute to order results by. Defaults to "search_rank" for fredr_series_search_text() and "series_id" for fredr_series_search_id(). Possible values are:

  • "search_rank"

  • "series_id"

  • "title"

  • "units"

  • "frequency"

  • "seasonal_adjustment"

  • "realtime_start"

  • "realtime_end"

  • "last_updated"

  • "observation_start"

  • "observation_end"

  • "popularity"

  • "group_popularity"

sort_order

A string representing the order of the resulting series. Possible values are: "asc" (default), and "desc".

realtime_start

A Date indicating the start of the real-time period. Defaults to today's date. For more information, see Real-Time Periods.

realtime_end

A Date indicating the end of the real-time period. Defaults to today's date. For more information, see Real-Time Periods.

Value

A tibble object where each row represents a series matching the query.

References

API Documentation:

series/search

Examples

if (fredr_has_key()) {
# search for series with text matching "oil" and return the top 10 most popular
# series
fredr_series_search_text(
  search_text = "oil",
  order_by = "popularity",
  limit = 10
)
# search for series with text matching "oil" with the tag "usa" and return the
# top 10 search results
fredr_series_search_text(
  search_text = "oil",
  order_by = "search_rank",
  limit = 10,
  tag_names = "usa"
)
# search for series with text matching "unemployment" and return only series
# with monthly frequency
fredr_series_search_text(
  search_text = "unemployment",
  filter_variable = "frequency",
  filter_value = "Monthly"
)
# search for series ID matching "UNRATE" and return oldest series first
fredr_series_search_id(
  search_text = "UNRATE",
  order_by = "observation_start"
)
}
#> # A tibble: 16 × 16
#>    id        realtime_start realtime_end title observation_start observation_end
#>    <chr>     <chr>          <chr>        <chr> <chr>             <chr>          
#>  1 UNRATE    2023-04-17     2023-04-17   Unem… 1948-01-01        2023-03-01     
#>  2 UNRATENSA 2023-04-17     2023-04-17   Unem… 1948-01-01        2023-03-01     
#>  3 UNRATECT… 2023-04-17     2023-04-17   Long… 2009-02-18        2023-03-22     
#>  4 UNRATECT… 2023-04-17     2023-04-17   Long… 2009-02-18        2023-03-22     
#>  5 UNRATECT… 2023-04-17     2023-04-17   Long… 2009-02-18        2023-03-22     
#>  6 UNRATERH… 2023-04-17     2023-04-17   Long… 2009-02-18        2023-03-22     
#>  7 UNRATERL… 2023-04-17     2023-04-17   Long… 2009-02-18        2023-03-22     
#>  8 UNRATERM… 2023-04-17     2023-04-17   Long… 2009-02-18        2023-03-22     
#>  9 UNRATEMD… 2023-04-17     2023-04-17   Long… 2015-06-17        2023-03-22     
#> 10 UNRATECTH 2023-04-17     2023-04-17   FOMC… 2023-01-01        2025-01-01     
#> 11 UNRATECTL 2023-04-17     2023-04-17   FOMC… 2023-01-01        2025-01-01     
#> 12 UNRATECTM 2023-04-17     2023-04-17   FOMC… 2023-01-01        2025-01-01     
#> 13 UNRATEMD  2023-04-17     2023-04-17   FOMC… 2023-01-01        2025-01-01     
#> 14 UNRATERH  2023-04-17     2023-04-17   FOMC… 2023-01-01        2025-01-01     
#> 15 UNRATERL  2023-04-17     2023-04-17   FOMC… 2023-01-01        2025-01-01     
#> 16 UNRATERM  2023-04-17     2023-04-17   FOMC… 2023-01-01        2025-01-01     
#> # ℹ 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>