遇到一个奇怪的事情,就是交易数据无法做candleChart?
数据如下
> str(w)
An ‘xts’ object on 2007-08-13/2015-06-26 containing:
Data: chr [1:1830, 1:5] "60.70" "62.70" "63.59" "60.08" "56.24" ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:5] "Open" "High" "Low" "Close" ...
Indexed by objects of class: [POSIXct,POSIXt] TZ:
xts Attributes:
NULL
> head(w)
Open High Low Close Volume
2007-08-13 "60.70" "63.88" "60.00" "61.56" " 2902284"
2007-08-14 "62.70" "63.80" "59.00" "59.00" " 1835485"
2007-08-15 "63.59" "65.77" "60.50" "62.00" " 1912607"
2007-08-16 "60.08" "61.99" "59.02" "61.90" " 1639114"
2007-08-17 "56.24" "59.93" "56.00" "59.00" " 1510208"
2007-08-20 "56.55" "57.70" "55.11" "56.50" " 819922"
> candleChart(w)
Error in na.omit.xts(x) : unsupported type
但是这个数据却可以
> head(GSPC)
Open High Low Close Volume Adjusted
1970-01-02 92.06 93.54 91.79 93.00 8050000 93.00
1970-01-05 93.00 94.25 92.53 93.46 11490000 93.46
1970-01-06 93.46 93.81 92.13 92.82 11460000 92.82
1970-01-07 92.82 93.38 91.93 92.63 10010000 92.63
1970-01-08 92.63 93.47 91.99 92.68 10670000 92.68
1970-01-09 92.68 93.25 91.82 92.40 9380000 92.40
> str(GSPC)
An ‘xts’ object on 1970-01-02/2009-09-15 containing:
Data: num [1:10022, 1:6] 92.1 93 93.5 92.8 92.6 ...
- attr(*, "dimnames")=List of 2
..$ : NULL
..$ : chr [1:6] "Open" "High" "Low" "Close" ...
Indexed by objects of class: [Date] TZ: GMT
xts Attributes:
List of 2
$ src : chr "yahoo"
$ updated: POSIXt[1:1], format: "2009-10-06 23:47:09"
然后用candleChart就可以,2个数据都是xts,为什么有这样的差异,求高手帮忙?