下面的代码一直有效,直到最近。
library("quantmod")
library("PerformanceAnalytics")
library("ggplot2")
library("fPortfolio")
library("fAssets")
library("reshape2")
library("corrplot")
library("gridExtra")
library("dplyr")
Data_SP <- new.env()
### Download the data from yahoo finance
SP_tickers<-c("SPY","AAGPX","AUIAX","BHBFX","CABDX","CGRWX","EHSTX","HDGYX","KDCAX","LEIFX","NBPBX","OLVAX","PGRWX")
start.time<-proc.time()
getSymbols(SP_tickers, from="1998-12-29", env=Data_SP)
Returns <- eapply(Data_SP, function(s) ROC(Ad(s), type="discrete"))
proc.time()-start.time
系统返回以下错误:
Error in lag(x, n, na.pad = na.pad) : unused argument (na.pad = na.pad)
任何建议如何让上述工作再次?
(出现此错误后,所有软件包均已更新)
回溯下方:
4 lag(x, n, na.pad = na.pad)
3 ROC(Ad(s), type = "discrete")
2 FUN(list(structure(c(20.7, 20.57, 20.49, 20.52, 20.76, 21.2,
21.22, 21.42, 21.21, 20.84, 20.73, 20.27, 20.74, 20.83, 20.84,
20.57, 20.35, 20.41, 20.53, 20.3, 20.6, 20.82, 20.62, 20.48,
20.62, 20.35, 20.32, 20.32, 20.01, 20.1, 20.39, 20.1, 20.28, ...
1 eapply(Data_SP, function(s) ROC(Ad(s), type = "discrete"))