Get the related FRED tags for one or more FRED tags within a category. Optionally, filter results by tag group or search. FRED tags are attributes assigned to series. Related FRED tags are the tags assigned to series that match all tags in the tag_names parameter, no tags in the exclude_tag_names parameter, and the category set by the category_id parameter. Series are assigned tags and categories. Indirectly through series, it is possible to get the tags for a category. No tags exist for a category that does not have series.

fredr_category_related_tags(
  category_id,
  tag_names,
  ...,
  exclude_tag_names = NULL,
  tag_group_id = NULL,
  search_text = NULL,
  limit = NULL,
  offset = NULL,
  order_by = NULL,
  sort_order = NULL,
  realtime_start = NULL,
  realtime_end = NULL
)

Arguments

category_id

An integer ID for the category.

tag_names

A string indicating which series tags to match. Multiple tags can be delimited by a semicolon in a single string (e.g. "usa;gnp").

...

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

exclude_tag_names

A string indicating which series tags should not be matched. Multiple tags can be delimited by a semicolon in a single string (e.g. `"usa;gnp"``).

tag_group_id

A string representing the tag group id to filter tags by type. No filtering by default. Possible values include:

  • "freq" - Frequency

  • "gen" - General or Concept

  • "geo" - Geography

  • "geot" - Geography Type

  • "rls" - Release

  • "seas" - Seasonal Adjustment

  • "src" - Source

search_text

A string to match text of tags. No matching by default.

limit

An positive integer indicating maximum number of results to return. Possible values are any integer between 1 and 1000 (default), inclusive.

offset

An non-negative 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

Order results by values of the specified attribute. Possible values include: "series_count" (default), "popularity"``, "created", "name", "group_id"`.

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 information on related tags matching the request. Data include tag name, group ID, popularity, series count, tag creation date, and additional notes.

API Documentation

fred/category/related_tags

See also

Examples

if (fredr_has_key()) { # First, get the tags for the "Production & Business Activity" category fredr_category_tags(1L) # Then, get the tags related to "business" and "monthly" for the # "Production & Business Activity" category fredr_category_related_tags(category_id = 1L, tag_names = "business;monthly") }
#> # A tibble: 108 x 6 #> name group_id notes created popularity series_count #> <chr> <chr> <chr> <chr> <int> <int> #> 1 census src "Census" 2012-02-27 … 80 1658 #> 2 public domain: … cc NA 2018-12-17 … 100 1658 #> 3 usa geo "United State… 2012-02-27 … 100 1658 #> 4 state geot "State" 2012-02-27 … 75 1108 #> 5 business format… gen NA 2019-03-19 … 11 932 #> 6 nsa seas "Not Seasonal… 2012-02-27 … 100 894 #> 7 sa seas "Seasonally A… 2012-02-27 … 88 764 #> 8 business applic… gen NA 2019-03-19 … 32 718 #> 9 nation geot "" 2012-02-27 … 99 456 #> 10 spliced gen "" 2021-02-08 … 0 318 #> # … with 98 more rows