[R] Extracting specific rows from irregular zoo object and merging with a regular zoo object

Sergey Goriatchev sergeyg at gmail.com
Thu Apr 8 17:18:42 CEST 2010


Hello, everyone

I have the following problem:
Say I have an irregular zoo timeseries like this:

a <- zoo(rep(1:9), as.Date(c("2009-03-20", "2009-03-27", "2009-04-24",
"2009-04-25", "2009-04-30", "2009-05-15", "2009-05-22", "2009-05-29",
"2009-06-26")))

and I have regular zoo timeseries like this:

b <- zoo(rep(1:4), as.Date(c("2009-03-31", "2009-04-30", "2009-05-31",
"2009-06-30")))

>From "a" I need to extract those rows that hold values for the last
day of each month (creating series "c"). Then I have to merge these
values with "b", such that the result has the index of "c".

How could I do this most efficiently?

Thank you in advance!

Best,
Sergey

--
Simplicity is the last step of art./Bruce Lee



More information about the R-help mailing list