if (FALSE) {
# 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())
}
Run the code above in your browser using DataLab