I have a data frame of time series:
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
I want to take this time series and change it to a list of 3 items, each being an XTS created from columns 1-2, 3-4 and 5-6. Note that the time series do not necessarily have the same dates.
I would be extra happy if someone could show me how to do this with using the plyr
library.
dput
of my data frame:
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")