我有一个时间序列的数据框:
X1.HK.Equity X X2.HK.Equity X.2 X3.HK.Equity X.4
1 31/12/2002 38.855 31/12/2002 19.547 31/12/2002 5.011
2 02/01/2003 38.664 02/01/2003 19.547 02/01/2003 4.986
3 03/01/2003 40.386 03/01/2003 19.547 03/01/2003 4.962
4 06/01/2003 40.386 06/01/2003 19.609 06/01/2003 4.937
5 07/01/2003 40.195 07/01/2003 19.609 07/01/2003 4.937
6 08/01/2003 40.386 08/01/2003 19.547 08/01/2003 4.912
我想采用这个时间序列并将其更改为 3 个项目的列表,每个项目都是从第 1-2、3-4 和 5-6 列创建的 XTS。请注意,时间序列不一定具有相同的日期。
plyr
如果有人能告诉我如何使用库来做到这一点,我会非常高兴。
dput
我的数据框:
structure(list(X1.HK.Equity = c("31/12/2002", "02/01/2003", "03/01/2003",
"06/01/2003", "07/01/2003", "08/01/2003"), X = c(38.855, 38.664,
40.386, 40.386, 40.195, 40.386), X2.HK.Equity = c("31/12/2002",
"02/01/2003", "03/01/2003", "06/01/2003", "07/01/2003", "08/01/2003"
), X.2 = c(19.547, 19.547, 19.547, 19.609, 19.609, 19.547), X3.HK.Equity = c("31/12/2002",
"02/01/2003", "03/01/2003", "06/01/2003", "07/01/2003", "08/01/2003"
), X.4 = c(5.011, 4.986, 4.962, 4.937, 4.937, 4.912)), .Names = c("X1.HK.Equity",
"X", "X2.HK.Equity", "X.2", "X3.HK.Equity", "X.4"), row.names = c(NA,
6L), class = "data.frame")