Hi
I have two irregular time series, which are of different lengths and being
and end at different times. For the common subset of time that they both
span, they should have the same values, but the values may occur at
slightly different time intervals. I am trying to "line up" the identical
values and reconcile them. I have merged the two series into a zoo object
which looks like the following:
> head(m)
aq$mid d2$mid
2009-06-22 16:25:40.044 NA 1.63755
2009-06-22 16:25:40.909 1.63760 NA
2009-06-22 16:25:40.987 NA 1.63760
2009-06-22 16:25:41.657 1.63755 NA
2009-06-22 16:25:41.738 NA 1.63755
2009-06-22 16:25:41.909 1.63760 NA
What I would like to do is merge the series column-wise : ie where one
column contains NAs, replace the NAs with the non-NA value from the other
column. Is this possible easily?
Here is a dput() of the data above:
structure(c(NA, 1.6376, NA, 1.63755, NA, 1.6376, 1.63755, NA,
1.6376, NA, 1.63755, NA), .Dim = c(6L, 2L), .Dimnames = list(
NULL, c("aq$mid", "d2$mid")), index = structure(c(1245684340.044,
1245684340.909, 1245684340.987, 1245684341.657, 1245684341.738,
1245684341.909), class = c("POSIXt", "POSIXct")), class = "zoo")
Cheers
-- Rory
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.