fredr-key {fredr}R Documentation

FRED API key

Description

Users of fredr must authenticate with the FRED API by use of an API key. This key should be stored as an environment variable, FRED_API_KEY.

Usage

fredr_set_key(key)

fredr_get_key()

fredr_has_key()

Arguments

key

A valid FRED API key as a string. Obtain one at the API Keys page. Can also be NULL to unset the key for the current R session.

Details

The preferred method to set the key is to set the FRED_API_KEY environment variable in an .Renviron file. The easiest way to do this is by calling usethis::edit_r_environ(). Don't forget to restart R after setting the key.

References

See St. Louis Fed Web Services API Keys to obtain an API key.

See Also

Note that by using a FRED API key, you agree to the FRED API Terms of Use.

Examples

original_key <- fredr_get_key()

# Set a once per session key
fredr_set_key("foo")

# Get it
fredr_get_key()

# Reset to original key
fredr_set_key(original_key)

[Package fredr version 2.1.0 Index]