[R-SIG-Finance] Ops on zoo objects

Ian Seow ianseow at gmail.com
Mon Jan 7 12:12:56 CET 2008


Hi guys, currently the zoo package extends the group generic functions
Ops to perform operations only for the **intersection** of the indexes
of the objects. Was just wondering if anyone has came across an
elegant/simple solution for operations on the union of the indexes?
I'm trying to look for a clean way of adding the signals of my
different trading models which return zoo time-series with indexes
which are not necessary the same. Unfortunately, the only way I can
think of is to merge the zoo objects, obtain the union of the indexes,
prepend / append each zoo object with zeros, and then add them. This
looks really ugly especially when there are many objects to be added
:(

Brief example:

> model1.output

               EURUSD   USDJPY
2007-12-27 -19.470868 32.79096
2007-12-28 -17.159300 32.79096
2008-01-02 -17.162815 32.79096
2008-01-03  -5.701861 10.93032
2008-01-04  -5.701861 10.93032

> model2.output

               EURUSD   USDJPY
2007-12-27 -20.470868 11.79096
2007-12-28 -20.159300 11.79096
2008-01-02 -20.162815 11.79096

model1.output + model2.output would return a zoo object starting from
2007-12-27 to 2008-01-02. :(
Any tips on this would be greatly appreciated!
Thanks!

Best regards
Ian Seow
GIC



More information about the R-SIG-Finance mailing list