[R] cbind giving NA's?

Hasan Diwan hasan.diwan at gmail.com
Fri Aug 26 12:58:43 CEST 2011


On 26 August 2011 03:37, R. Michael Weylandt <michael.weylandt at gmail.com> wrote:
> If you could, dput() them so we can see everything about them. You also
> might see if merge() gives you more expected behavior....

Ok...
> dput(a)
structure(c(7.6343, 7.6343, 7.5458, 7.4532, 7.404, 7.3317), class = c("xts",
"zoo"), .indexCLASS = "Date", .indexTZ = "", index = structure(c(1270105200,
1270191600, 1270278000, 1270364400, 1270450800, 1270537200), tzone =
"", tclass = "Date"), .Dim = c(6L,
1L), .Dimnames = list(NULL, "ZWD.UGX"))
> dput(b)
structure(c(28.02, 28.3, 28.38, 28.21, 28.31, 28.47), .indexCLASS =
"Date", .indexTZ = "", src = "yahoo", updated =
structure(1314356091.21457, class = c("POSIXct",
"POSIXt")), class = c("xts", "zoo"), index = structure(c(1270072800,
1270418400, 1270504800, 1270591200, 1270677600, 1270764000), tzone =
"", tclass = "Date"), .Dim = c(6L,
1L), .Dimnames = list(NULL, "SCHB.Close"))
> merge(a,b)
> merge(a,b)
           ZWD.UGX SCHB.Close
2010-04-01      NA      28.02
2010-04-01  7.6343         NA
2010-04-02  7.6343         NA
2010-04-03  7.5458         NA
2010-04-04  7.4532         NA
2010-04-05      NA      28.30
2010-04-05  7.4040         NA
2010-04-06      NA      28.38
2010-04-06  7.3317         NA
2010-04-07      NA      28.21
2010-04-08      NA      28.31
2010-04-09      NA      28.47
> q()

So, no, merge doesn't work...
-- 
Sent from my mobile device
Envoyait de mon telephone mobil



More information about the R-help mailing list