在学习R blotter中,发现该包挺强的。但是在学习demo中,turtles的demo发现个问题。如果直接运行demo,可以顺利走下来。
但是如果我修改了demo中的起始日期,把
initDate="2008-01-01" 修改为任意时间,如
initDate="2013-01-09"
运行后,就报错。报错信息如下:
[1] "2013-04-03 00:00:00 XLP 86 @ 39.740002"
[1] "2013-04-04 00:00:00 XLP 81 @ 39.950001"
[1] "2013-04-09 00:00:00 XLP 76 @ 40.07"
[1] "2013-04-11 00:00:00 XLF 252 @ 18.549999"
[1] "2013-04-11 00:00:00 XLP 75 @ 40.560001"
[1] "2013-04-16 00:00:00 XLF -252 @ 18.360001"
[1] "2013-04-16 00:00:00 XLE -11 @ 75.739998"
Error in structure(.Data = x, index = structure(index, tzone = tzone, :
'dimnames'的长度[2]必需与陈列范围相等
Called from: structure(.Data = x, index = structure(index, tzone = tzone,
tclass = orderBy), class = c("xts", "zoo"), .indexCLASS = orderBy,
tclass = orderBy, .indexTZ = tzone, tzone = tzone, ...)
无法排查出什么原因。逐步分解跑起来都没报错。。。