[英]Quantmod: How do I leave the XTS output variable?
I am new to R and quantmod. 我是R和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? 如何保持
GOOG
作为一个变量as.vector(GOOG[,check_symbol2])
上面的代码中的一部分?
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
: 似乎您将从
auto.assign=FALSE
的调用中使用auto.assign=FALSE
getSymbols
:
check_symbol <- "GOOG"
check_symbol_data <- getSymbols(check_symbol, auto.assign=FALSE)
temp <- as.vector(Ad(check_symbol_data))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.