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

Make getSymbols() return the data it retrieves

In the last exercise, getSymbols() automatically created an object named like the symbol you provided. This exercise will teach you to make getSymbols() return the data, so you can assign the output yourself.

There are two arguments that will make getSymbols() return the data:

  1. Set auto.assign = FALSE.
  2. Set env = NULL.

The two methods are functionally equivalent, but auto.assign = FALSE describes the behavior better. Use it because you will be more likely to remember what auto.assign = FALSE means in the future.

Bu egzersiz

Importing and Managing Financial Data in R

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

Egzersiz talimatları

  • Download SPY data and assign it to an object named spy by using the auto.assign argument.
  • Use the str() function to view the structure of the spy object.
  • Download JNJ data and assign it to an object named jnj by using the env argument.
  • Use the str() again, but on the jnj object.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Assign SPY data to 'spy' using auto.assign argument


# Look at the structure of the 'spy' object


# Assign JNJ data to 'jnj' using env argument


# Look at the structure of the 'jnj' object
Kodu Düzenle ve Çalıştır