csv文件:
"Date","","","","","",
"2014-01-03",1832.98,1838.24,1829.13,1831.37,0,1831.37
"2014-01-06",1831.37,1837.16,1823.73,1826.77,0,1826.77
"2014-01-07",1826.77,1840.1,1828.71,1837.88,0,1837.88
"2014-01-08",1837.88,1840.02,1831.4,1837.49,0,1837.49
命令:
> getSymbols("SPX3",src="csv")
> SPX3:
SPX3.Open SPX3.High SPX3.Low SPX3.Close SPX3.Volume
2014-07-23 1832.98 1838.24 1829.13 1831.37 0
2014-07-23 1831.37 1837.16 1823.73 1826.77 0
2014-07-23 1826.77 1840.10 1828.71 1837.88 0
2014-07-23 1837.88 1840.02 1831.40 1837.49 0
SPX3.Adjusted
2014-07-23 1831.37
2014-07-23 1826.77
2014-07-23 1837.88
2014-07-23 1837.49
因此,除了日期之外,它已正确加载所有内容。谁知道为什么?顺便说一句,这个问题和这个人有同样的问题(Date error while reading csv file into getSymbols),但是没有解决方案。
答案 0 :(得分:1)
使用setSymbolLookup
指定应从CSV中读取SPX3
并确保format
正确无误。
require(quantmod)
setSymbolLookup(SPX3=list(src="csv",format="%Y-%m-%d"))
getSymbols("SPX3")