Exercise

Data sources

In the last exercise, you imported data from Yahoo! Finance. The src argument allows you to tell getSymbols() to import data from a different data source.

In this exercise, you will import data from Google Finance and FRED. Google Finance is a source similar to Yahoo! Finance. FRED is an online database of economic time series data created and maintained by the Federal Reserve Bank of St. Louis.

getSymbols() imports data from Yahoo! Finance by default because src = "yahoo" by default. The src values for Google Finance and FRED are "google" and "FRED", respectively.

The quantmod package has already been loaded for you.

Instructions

100xp

Use getSymbols() to import QQQ data from Google Finance by setting src.

Use str() to view the structure of QQQ; note the src attribute.

Now use getSymbols() to import U.S. GDP data from FRED by setting src (the symbol for U.S. GDP is "GDP").