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

Create valid name for one instrument

If you are only downloading data for a single symbol and that symbol is not a syntactically valid name, you can set auto.assign = FALSE in your call to getSymbols(). That will allow you to directly assign the output to a syntactically valid name.

You may also want to convert the column names to syntactically valid names. That is a good idea if you plan to use the data in functions that expect column names to be syntactically valid names (e.g. lm()).

Bu egzersiz

Importing and Managing Financial Data in R

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

Egzersiz talimatları

  • Use getSymbols() and its auto.assign argument to create an object named BRK.A containing data for "BRK-A".
  • Use colnames() to create an object named col_names that contains the column names for the BRK.A object.
  • Use make.names() to convert col_names to syntactically valid names.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Create BRK.A object


# Create col_names object from the colnames() of BRK.A
col_names <- 

# Convert col_names into syntactically valid names
colnames(BRK.A) <- 
Kodu Düzenle ve Çalıştır