[R-SIG-Finance] Combining XTS objects with unmatched but regular dates

Worik worik.stanton at gmail.com
Wed Aug 18 06:34:29 CEST 2010


I have two xts objects
 > head(a)
                   a
2008-12-30 16061.73
2009-01-29 14709.56
2009-02-26 13148.36
2009-03-30 14298.04
2009-04-29 15665.30
2009-05-28 16540.47
 > head(b)
               b
2008-12-31 0.13
2009-01-31 0.30
2009-02-28 0.21
2009-03-31 0.16
2009-04-30 0.18
2009-05-31 0.18

I would like to merge them combining the entries on common dates.  Just 
removing the days would be enough.

 > head(merge(a,b))
                   a    b
2008-12-30 16061.73   NA
2008-12-31       NA 0.13
2009-01-29 14709.56   NA
2009-01-31       NA 0.30
2009-02-26 13148.36   NA
2009-02-28       NA 0.21

That is no good.

How can I do this?

cheers
Worik

-- 
You do not have to be blind to not see what is going on right in front of you if it is behind your back
Pascall West
--



More information about the R-SIG-Finance mailing list