BaşlayınÜcretsiz Başlayın

Set a default data source

Recall that getSymbols() imports from Yahoo Finance by default. This exercise will teach you how to change the default data source with the setDefaults() function.

The first argument to setDefaults() is the function you want to update, and the remaining arguments are name = value pairs of the arguments you want to update and the new default value.

Note that this only works with getSymbols() because getSymbols() actively checks to see if you want to use a different default value.

Bu egzersiz

Importing and Managing Financial Data in R

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Set the src argument to pull from Alpha Vantage instead of Yahoo by default.
  • Use getSymbols() to pull data for "GOOG".
  • Use str() to verify that src attribute on GOOG is "alphavantage".

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Set the default to pull data from Alpha Vantage


# Load GOOG data
getSymbols("___")

# Verify the data was actually pulled from Alpha Vantage
Kodu Düzenle ve Çalıştır