[R] cbind giving NA's?

Hasan Diwan hasan.diwan at gmail.com
Fri Aug 26 12:05:34 CEST 2011


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



More information about the R-help mailing list