1

I am using quantmod to get stock prices for a ticker, which creates an xts object.

When I try to write this object into a csv file, I can't seem to figure out how to call the object using the variable name. See below:

ticker="IBM"
getSymbols(ticker,from='1990-01-01')
write.table(ticker,file="deleteme.csv", col.names=FALSE, sep=',')
write.table(as.data.frame(ticker),file="deleteme2.csv", col.names=FALSE, sep=',')

Does anyone know how I can pass in the variable "ticker" and the write.table command will know that it needs to call the IBM xts data file?

Thank you!!

Joshua Ulrich
  • 173,410
  • 32
  • 338
  • 418
Trexion Kameha
  • 3,362
  • 10
  • 34
  • 60

1 Answers1

1

Found a workaround! We need to turn the auto assign off in the quantmod function.

symbols<-getSymbols(px_ticker,from='1990-01-01', auto.assign=F)
Trexion Kameha
  • 3,362
  • 10
  • 34
  • 60