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