ÎncepețiÎncepe gratuit

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 Alpha Vantage and FRED. Alpha Vantage 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 Alpha Vantage and FRED are "av" and "FRED", respectively.

The quantmod package has already been loaded for you.

Acest exercițiu face parte din cursul

Importing and Managing Financial Data in R

Vezi cursul

Instrucțiuni pentru exercițiu

  • Use getSymbols() to import QQQ data from Alpha Vantage 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").
  • Use str() to view the structure of GDP; note the src attribute.

Exercițiu interactiv practic

Încearcă acest exercițiu completând acest cod de exemplu.

# Import QQQ data from Alpha Vantage


# Look at the structure of QQQ


# Import GDP data from FRED


# Look at the structure of GDP
Editează și rulează codul