Hmm, that's quite puzzling. I don't know but I'd willing to guess the
time/date stamps on a,b are more different than the output is leading us to
believe. My experience is that there's always more to a time/date object to
trick us up than one would expect.

If you could, dput() them so we can see everything about them. You also
might see if merge() gives you more expected behavior....

Michael Weylandt


On Fri, Aug 26, 2011 at 6:05 AM, Hasan Diwan <hasan.diwan@gmail.com> wrote:

> I have two xts objects, call them "a" and "b", and am trying to merge
> them...
> > class(a)
> [1] "xts" "zoo"
> > class(b)
> [1] "xts" "zoo"
> > head(a)
> 2010-04-01  7.6343
> 2010-04-02  7.6343
> 2010-04-03  7.5458
> 2010-04-04  7.4532
> 2010-04-05  7.4040
> 2010-04-06  7.3317
> > head(b)
> 2010-04-01     568.80
> 2010-04-05     571.01
> 2010-04-06     568.22
> 2010-04-07     563.54
> 2010-04-08     567.49
> 2010-04-09     566.22
> > head(cbind(a,b))
> 2010-04-01     568.80      NA
> 2010-04-01         NA  0.3998
> 2010-04-02         NA  0.3998
> 2010-04-03         NA  0.3999
> 2010-04-04         NA  0.3994
> 2010-04-05     571.01      NA
> > q()
> I'd like the cbind'ed version to look like:
> 2010-04-01     568.80    0.3998
> 2010-04-02         NA  0.3998
> 2010-04-03         NA  0.3999
> 2010-04-04         NA  0.3994
> 2010-04-05     571.01      0.3991
>
> What gives? Many thanks, in advance. -- H
>
> --
> Sent from my mobile device
> Envoyait de mon telephone mobil
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]

