Try this:
> window(old, time(new)) <- ifelse(is.na(new), old[time(new)], new)
> old
PPAR pcp
(05/19/06 23:58:00) NA NA NA
(05/20/06 00:00:00) 956.23 252.30 NA
(05/20/06 00:02:00) 955.68 244.85 0
(05/20/06 00:04:00) 955.70 236.45 0
(05/20/06 00:06:00) 955.
Gabor,
Many thanks for your suggestion. This solution is very close, but not exactly
what I had in mind, because na.omit removes the entire row in which an NA
appears. I want to replace values in old with non-NA values from corresponding
times in new. If a timestamp from old does not appear
An example that included input and output would help. I'll take a guess but if
that's not it please clarify and provide that.
Also its helpful if you can provide the data in easily copied form
using dput(z).
I will assume that time(New) is a superset of time(Old) and "put them in" means
replace
Hello,
I have two zoo objects, new and old, indexed by chron objects. Their structure
is like this:
(05/25/06 00:00:00) NA NA NA
(05/25/06 00:02:00) 948.20 24.198 0
(05/25/06 00:04:00) 948.26 20.640 0
(05/25/06 00:06:00) 948.37 19.653 0
(05/25/06 00:08:00) 948.48 19.135 0
(05/2
4 matches
Mail list logo