尝试使用quantmod包下载符号列表时遇到错误。
我有以下内容;
startdate <- "2017-11-05"
enddate <- "2018-01-20"
Symbols <- c("XOM","MSFT","JNJ", "BRK.B","GE","CVX","WFC","PG","JPM","VZ","PFE","T","IBM","MRK","BAC","DIS","ORCL","PM","INTC","SLB")
dailyreturns = lapply(Symbols, function(sym) {
dailyReturn(na.omit(getSymbols(sym, from= startdate, to = enddate, auto.assign=FALSE, src = "yahoo")))
})
返回以下错误消息;
Warning: BRK.B download failed; trying again.
我尝试使用complete cases
和其他方法跳过失败的下载数据但仍然存在此错误
Warning: BRK.B download failed; trying again.
Error: BRK.B download failed after two attempts. Error message:
HTTP error 404.
Called from: getSymbols.yahoo(Symbols = "BRK.B", env = <environment>, verbose = FALSE,
warnings = TRUE, auto.assign = FALSE, from = "2017-11-05",
to = "2018-01-20")
提前致谢!
答案 0 :(得分:1)
我也遇到了这个问题,原因是它不是BRK.B
,而是BRK-B
。通常,如果是-
,则从.csv文件读取时,R会将列名的.
转换为check.names = TRUE
。