R 中的 getSymbols 已弃用警告消息 'indexClass<-'

Warning message 'indexClass<-' is deprecated from getSymbols in R

我使用 R 版本 3.6.3 (2020-02-29) 和 quantmod 包 0.4-15

最近更新后,当我尝试使用 quantmod 获取数据时:

getSymbols("^GSPC", src="yahoo", from = '2010-01-01', auto.assign = FALSE)

我看到下一条警告消息:

Warning message:
'indexClass<-' is deprecated.
Use 'tclass<-' instead.

我真的不明白我要改变什么...

由于 xts 0.12-0 的更改,这是 quantmod 0.4-15 中的错误。所以你没有做错任何事,你(作为用户)也无法避免。

该错误已在 quantmod 0.4-16 中修复,目前在 CRAN 上。也就是说,Windows 二进制文件在我写这篇文章时尚未构建,因此您必须从源代码安装或等待几天。