Users of the fredr package must authenticate with the FRED API by use of
an API key. The function fredr_set_key() sets the FRED API key as an
environment variable for use with the service. For persistence across sessions,
see the Details section.
Usage
fredr_set_key(key)
Arguments
key
A valid FRED API key as a string. Obtain one at the
API Keys page.
Details
fredr_set_key() sets a key as an environment variable for use with
the fredr package in the current session. The key can also be set in the
.Renviron file at the user or project level scope. You can edit the file manually by
appending the line FRED_API_KEY = my_api_key, where my_api_key is your
actual key (remember to not surround the key in quotes). The function
usethis::edit_r_environ() does this safely. Run
base::readRenviron(".Renviron") to set the key in the current session
or restart R for it to take effect. The variable will be set in subsequent
sessions in the working directory if you set it with project level scope,
or everywhere if you set it with user level scope.
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.