[R] Problem with merging two zoo objects

Dieter Menne dieter.menne at menne-biomed.de
Fri Oct 15 20:31:17 CEST 2010



Megh wrote:
> 
> Dear all, I have following 2 zoo objects. However when I try to merge
> those 2 objects into one, nothing is coming as intended. Please see below
> the objects as well as the merged object:
> 
> ....
>> merge(dat11, dat22)
>                     V2.dat11 V3.dat11 V4.dat11 V5.dat11 V2.dat22 V3.dat22
> V4.dat22 V5.dat22
> 2010-10-15 12:09:12       NA       NA       NA       NA       NA       NA      
> NA       NA
> 
Since the simulated example works, it must have to do with your data. Try
str(dat11), str(dat12), maybe something strange has crept in.

Dieter


library(zoo)
x.date <- as.Date(paste(2003, 02, c(1, 3, 7, 9, 14), sep = "-"))
x <- zoo(matrix(1:10, ncol = 2), x.date)
x
str(x)

y.date <- as.Date(paste(2006, 02, c(1, 3, 7, 9, 14), sep = "-"))
y <- zoo(matrix(11:20, ncol = 2), y.date)
y
str(y)

-- 
View this message in context: http://r.789695.n4.nabble.com/Problem-with-merging-two-zoo-objects-tp2997472p2997494.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list