r - 运行脚本后,我在下面收到一条警告消息
问题描述
为什么以下脚本会产生以下警告?
portfolioPrices <- NULL
for (ticker in tickers) {
portfolioPrices <- cbind(portfolioPrices, getSymbols.yahoo(ticker, from='2016-02-19', periodicity =
'daily', auto.assign=FALSE)[,4])
}
警告:
1: 'indexClass<-' is deprecated.
Use 'tclass<-' instead.
See help("Deprecated") and help("xts-deprecated").
2: 'indexClass<-' is deprecated.
Use 'tclass<-' instead.
See help("Deprecated") and help("xts-deprecated").
解决方案
通常的建议是让您提供 MWE……我们可以没有这里。
您现在可以放心地忽略这些警告消息,但请注意,如果quantmod
库维护者不更新他们的包以满足xts
库中的更改,这可能会在(近乎?)将来停止工作1。
要忽略上述警告,如果您想防止它们被打印到控制台 ,您可以将您的getSybmols
呼叫包装起来。suppressWarnings
Joshua Ulrich 负责这个包,并在一段时间前xts
进行了更改:请参阅 2018 年 4 月 20 日在 GitHub 上的提交indexClass
tclass
1作为维护良好的软件包的示例,您可以查看Brian Peterson 的 Quantstrat 软件包以及他如何替换indexClass
为tclass
,基本上解决了您在 中看到的警告quantmod
。
推荐阅读
- algorithm - 将景观划分为山坡和山谷的连接组件的算法
- javascript - 删除 react dropzone 中的默认相机选项
- python-3.x - python初学者 - 重复列表的值几次
- javascript - 节点 js 中的 CSP 谷歌标签管理器问题
- javascript - 如何在文本框中评估高血压状况
- javascript - Angular:知道何时启动所有子组件视图的方法
- c++ - 使用 std::minmax_element 作为用户数据类型
- javascript - 无法让日历日期选择器弹出 - Framework7
- jvm - Flink 独立集群:SIGSEGV 碾压 TaskManager
- python - python多图与matplotlib