getSymbols.FRED: Download Federal Reserve Economic Data - FRED(R)

getSymbols.FREDR Documentation

Download Federal Reserve Economic Data - FRED(R)

Description

R access to over 11,000 data series accessible via the St. Louis Federal Reserve Bank's FRED system.

Downloads Symbols to specified env from ‘research.stlouisfed.org’. This method is not to be called directly, instead a call to getSymbols(Symbols,src='FRED') will in turn call this method. It is documented for the sole purpose of highlighting the arguments accepted, and to serve as a guide to creating additional getSymbols ‘methods’.

Usage

getSymbols.FRED(Symbols,
                env,
                return.class = "xts",
                ...)

Arguments

Symbols

a character vector specifying the names of each symbol to be loaded

env

where to create objects. (.GlobalEnv)

return.class

class of returned object

...

additional parameters

Details

Meant to be called internally by getSymbols (see also).

One of many methods for loading data for use with quantmod. Essentially a simple wrapper to the underlying FRED data download site.

Naming conventions must follow those as seen on the Federal Reserve Bank of St Louis's website for FRED. A lookup facility will hopefully be incorporated into quantmod in the near future.

Value

A call to getSymbols.FRED will load into the specified environment one object for each Symbol specified, with class defined by return.class. Presently this may be ts, zoo, xts, or timeSeries.

Note

FRED changed its URL scheme for the downloads from http:// to https://. If getSymbols.FRED fails for this reason, try one of the following solutions:

  1. Explicitly pass method via the getSymbols call (or via setDefaults).

  2. Install downloader, which may be able to automagically determine a suitable method.

  3. Set the download.file.method global option.

Author(s)

Jeffrey A. Ryan

References

St. Louis Fed: Economic Data - FRED https://fred.stlouisfed.org/

See Also

getSymbols, setSymbolLookup

Examples

## Not run: 
# All 3 getSymbols calls return the same
# CPI data to the global environment
# The last example is what NOT to do!

## Method #1
getSymbols('CPIAUCNS',src='FRED')


## Method #2
setDefaults(getSymbols,src='FRED')
  # OR
setSymbolLookup(CPIAUCNS='FRED')

getSymbols('CPIAUCNS')

#########################################
##  NOT RECOMMENDED!!!
#########################################
## Method #3
getSymbols.FRED('CPIAUCNS',env=globalenv())

## End(Not run)

quantmod documentation built on May 29, 2024, 8:03 a.m.