我有两个xts
时间序列。它们的一个小样例:
ts1
[,1]
2009-05-06 00:00:00 38.414
2009-05-06 00:15:00 45.079
2009-05-06 00:30:00 38.878
2009-05-06 00:45:00 49.889
2009-05-06 01:00:00 41.270
2009-05-06 01:15:00 41.050
2009-05-06 01:30:00 38.951
2009-05-06 01:45:00 39.854
2009-05-06 02:00:00 37.803
2009-05-06 02:15:00 42.930
ts2
[,1]
2009-05-06 00:00:00 406.887
2009-05-06 00:15:00 413.298
2009-05-06 00:30:00 409.353
2009-05-06 00:45:00 412.312
2009-05-06 01:00:00 409.353
2009-05-06 01:15:00 415.271
2009-05-06 01:30:00 416.257
2009-05-06 01:45:00 416.257
2009-05-06 02:00:00 416.257
2009-05-06 02:15:00 419.216
现在我想要创建一个散点图,将ts1与ts2进行比较。根据CRAN的文档(我也在stackoverflow上找到了同样的例子),应该像这样工作:plot(ts1, ts2)
。但是我遇到了错误。
plot(ts1,ts2)
# Error in plot(xycoords$x, xycoords$y, type = type, axes = FALSE, ann = FALSE, :
# object 'xycoords' not found
出了什么问题?正常情况下使用带有 ~
符号的普通 ts
状态很好,但是在 xts
中无法正常工作。我也尝试过 plot(ts1[, 1], ts2[, 1])
。
plot.xts
不支持散点图。 - Joshua Ulrich