我用了以上的办法都不行,采用了 as.xts(read.zoo('c:/ifBACDaily.txt',header=T)) 这种方式之后,报错:
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, :
line 1 did not have 2 elements
我的文件内容是
date open high low close
1 2010-4-16 3872.8 3878.8 3818.0 3820.4
2 2010-4-19 3800.8 3801.8 3570.8 3602.2
3 2010-4-20 3614.0 3642.8 3574.0 3619.4
4 2010-4-21 3619.8 3686.0 3612.8 3672.0
5 2010-4-22 3665.0 3679.2 3615.8 3641.0
6 2010-4-23 3645.8 3670.8 3625.8 3626.0
请问如何才能转成xts对象?