2

I want to download data using quantmod, save them to files to be loaded later.

The following piece of R code

library(quantmod)

symbols <- c("DEXUSUK", "STLFSI", "GDP")
tmpdir <- tempdir()

getSymbols(symbols, src="FRED")
saveSymbols(symbols, file.path=tmpdir)

rm(list = symbols)

getSymbols(symbols, src="RData", dir=tmpdir, extension="RData")

produces an error on the last line:

Error in `colnames<-`(`*tmp*`, value = c("DEXUSUK.Open", "DEXUSUK.High",  : length of 'dimnames' [2] not equal to array extent

Yet valid .RData files get created in the temp. location and can be load()-ed individually.

Is this a problem in quantmod (using version 0.4-3 on R 3.1.2) or is this usage invalid?

Petr Wolf
  • 127
  • 7

1 Answers1

1

You need to specify col.names

getSymbols(symbols, src="RData", dir=tmpdir, extension="RData", col.names="Close")
#[1] "DEXUSUK" "STLFSI"  "GDP"  
GSee
  • 48,880
  • 13
  • 125
  • 145
  • `saveSymbols.days` or `saveSymbols.common` in conjunction with `getSymbols.FI` is an alternative. See [this post](http://stackoverflow.com/a/12239000/967840) – GSee Feb 19 '15 at 18:49