鉴于这两个xts对象:
> X
2012-02-01 09:31:40 2012-02-01 09:31:50 2012-02-01 09:33:30
-3.8993007 -2.0860621 -0.6308867
> Y
2012-02-01 09:32:00 2012-02-01 09:32:10 2012-02-01 09:32:20
1.1983066 -0.2071149 0.3887806
如何按时间加入它们并拥有一个包含索引的单个列对象9:31:40,9:31:50,9:32:00,9:32:10,9:32:20,9: 33:30?也就是说,我需要在一个序列中流式传输两个对象(不要将两个列X / Y合并到一个组合矩阵中)。
答案 0 :(得分:5)
> X <- xts(rnorm(1:10), Sys.time() + 1:10)
> Y <- xts(rnorm(1:10), Sys.time() - 10:1)
> rbind(X, Y)
[,1]
2012-05-15 13:07:25 1.1022975
2012-05-15 13:07:26 -0.4755931
2012-05-15 13:07:27 -0.7094400
2012-05-15 13:07:28 -0.5012581
2012-05-15 13:07:29 -1.6290935
2012-05-15 13:07:30 -1.1676193
2012-05-15 13:07:31 -2.1800396
2012-05-15 13:07:32 -1.3409932
2012-05-15 13:07:33 -0.2942939
2012-05-15 13:07:34 -0.4658975
2012-05-15 13:07:36 0.1340882
2012-05-15 13:07:37 -0.4906859
2012-05-15 13:07:38 -0.4405479
2012-05-15 13:07:39 0.4595894
2012-05-15 13:07:40 -0.6937202
2012-05-15 13:07:41 -1.4482049
2012-05-15 13:07:42 0.5747557
2012-05-15 13:07:43 -1.0236557
2012-05-15 13:07:44 -0.0151383
2012-05-15 13:07:45 -0.9359486