ChetanMV
ChetanMV

Reputation: 285

Quantmod: How do I leave the XTS output variable?

I am new to R and quantmod. I am trying to get daily data for a user defined ticker symbol, like this:

check_symbol<-"GOOG"
check_symbol2<-paste0(check_symbol,".Adjusted")
getSymbols(check_symbol)
temp<-as.vector(GOOG[,check_symbol2])

How do I keep GOOG as a variable in the as.vector(GOOG[,check_symbol2]) part of the above code?

Also, any more elegant way of doing this is much appreciated!

Upvotes: 0

Views: 82

Answers (1)

Joshua Ulrich
Joshua Ulrich

Reputation: 176648

It seems like you'd benefit from using auto.assign=FALSE in the call to getSymbols:

check_symbol <- "GOOG"
check_symbol_data <- getSymbols(check_symbol, auto.assign=FALSE)
temp <- as.vector(Ad(check_symbol_data))

Upvotes: 1

Related Questions