到目前为止,我的代码如下:
companyList <- read.csv("~/Downloads/companylist.csv")
ticker <- as.vector(as.character(companyList[1:10, 'Symbol']))
stockData <- new.env()
x <- 1
while(x<11){
getSymbols(ticker[x], auto.assign = TRUE, env = stockData)
x <- x + 1
}
data <- getSymbols(ticker[1], auto.assign = FALSE, env = stockData)
val1 <- data[1, 'FLWS.Open']
val2 <- data[2, 'FLWS.Open']
change <- val2 - val1
print(change)
当我尝试打印 2 个每日开盘值的变化时,没有任何显示。我的语法有错误吗?