Returns the API key set via fred_set_key() or the FRED_API_KEY
environment variable. Raises an error if no key is found.
See also
Other configuration:
clear_cache(),
fred_cache_info(),
fred_request(),
fred_set_key()
Examples
# \donttest{
op <- options(fred.cache_dir = tempdir())
try({
fred_get_key()
})
#> Error in fred_get_key() : No FRED API key found.
#> ℹ Set one with `fred_set_key()` or the `FRED_API_KEY` environment variable.
#> ℹ Register for a free key at <https://fredaccount.stlouisfed.org/apikeys>.
options(op)
# }