Quantmod getSymbols错误

时间:2017-12-07 21:09:19

标签: r quantmod

我试图使用此代码使用quantmod获取符号数据。

    getSymbols(c("^DJI"),src='yahoo',from='2014-11-24',to='2017-11-24')

我收到错误

    Error in 'colnames<-'('*tmp(', value = c("DJI.open", "DJI.High", "DJI.Low", :
    length of 'dimnames' [2] not equal to array extent

感谢您的帮助。

编辑:我在普通代码中遇到同样的错误。

    getSymbols(c("DWDP","AAPL","MCD","MRK","IBM","MMM","KO","DIS","CSCO","PG","TRV","UTX","HD","PFE","MSFT","VZ","GS","WMT","GE","INTC","BA","JPM","AXP","XOM","NKE","CAT","CVX","JNJ","UNH","V"),src='yahoo',from='2014-11-24',to='2017-11-24')

1 个答案:

答案 0 :(得分:0)

没有c。只是做

getSymbols('^DJI', src = 'yahoo', from = '2014-11-24', to = '2017-11-24')

回复编辑:

也许你的包和/或R已经过时了。我运行了你的确切代码

getSymbols(c("DWDP","AAPL","MCD","MRK","IBM","MMM","KO","DIS","CSCO","PG","TRV","UTX","HD","PFE","MSFT","VZ","GS","WMT","GE","INTC","BA","JPM","AXP","XOM","NKE","CAT","CVX","JNJ","UNH","V"),src='yahoo',from='2014-11-24',to='2017-11-24')

并且能够获得所有价格。