fred_search {eFRED}R Documentation

Search for Series on FRED

Description

Each function receives a character string and returns a data.frame containing information on different series, tags, or related tags of the search.

Usage

fred_search(text, key = NULL, args = list())

fred_search_tags(text, key = NULL, args = list())

fred_search_related_tags(text, key = NULL, args = list())

Arguments

text

character string used for search. All spaces will automatically be converted appropriately.

key

32 character lower-cased alpha-numeric character string

args

named list of other arguments passed to the API, including "limit", "offset", "sort_order", etc. See details below.

Details

Search arguments accept any of the following:

search_type

either "full_text" or "series_id" determining whether the description, title, units, and other information are searched or only the id. Defaults to full text.

realtime_start, realtime_end

character string of format "YYYY-MM-DD" determining the real-time period. This is used to find historical series.

limit

integer between 1 and 1000 determining the maximum number of results to return.

offset

Non-negative integer

order_by

One of the following: "search_rank", "series_id", "title", "units", "frequency", "seasonal_adjustment", "realtime_start", "realtime_end", "last_updated", "observation_start", "observation_end", "popularity", or "group_popularity". Default is "search_rank".

sort_order

Either "asc" for ascending or "desc" for descending order.

filter_variable

String to filter the results by.

tag_names

String of tag names separated by semicolons for filtering results.

exclude_tag_names

String of tag names separated by semicolons that should not be included.

These should be included in a list such as args = list(limit = 10, sort_order = "asc"). The results are included in a data.frame with all information about the series, including detailed notes. The results are best viewed in the RStudio Viewer or with the title extracted.

Each function returns the following information in a data.frame.

fred_search

Series id, its title, observations start and end, frequency, units, seasonal adjustment type, popularity, realtime start and end, and when it was last updated

fred_search_tags

Tag name and its group id, popularity of tag, number of series in each tag, when it was created, and other notes

fred_search_related_tags

Same as fred_search_tags

Value

data.frame with entries described in details

Functions

Examples

## Not run: 
api_key <- "abcdefghijklmnopqrstuvwxyz123456"

# Searching GDP in China, descending order by "title"
results <- fred_search("GDP China", key=api_key,
  args = list(sort_order="desc", order_by="title"))

# Fetch top 2 series
df <- fred(results$id[1:2])
head(df)

## End(Not run)


[Package eFRED version 0.1.0 Index]