简体   繁体   中英

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!

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))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM