访问由 getSymbols 返回的奇数对象 [英] Access odd-named object returned by getSymbols

查看:43
本文介绍了访问由 getSymbols 返回的奇数对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 quantmod 从 Yahoo 下载数据:

I'm downloading data from Yahoo using quantmod:

> getSymbols("HNZ-A.TO")
[1] "HNZ-A.TO"
Warning message:
In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m,  :
  downloaded length 70893 != reported length 200

该文件显示在我的 R 工作区中.数据就在那里,我可以使用 edit 来查看对象,但我不能使用该对象.例如:

The file shows up in my R workspace. The data is there and I can use edit to see the object, but I can't use the object. For example:

> head(HNZ-A.TO)
Error in head(HNZ - A.TO) : object 'HNZ' not found

我可以做什么来使用这个对象?

What can I do to use this object?

推荐答案

另一种选择是 setSymbolLookup 告诉 getSymbols 在查询中使用不同的 Symbol.

Another alternative is to setSymbolLookup to tell getSymbols to use a different Symbol in the query.

> setSymbolLookup(HNZ=list(src="yahoo", name="HNZ-A.TO"))
> getSymbols("HNZ")
[1] "HNZ"

这篇关于访问由 getSymbols 返回的奇数对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆