[R] extracting data from zoo series
Gabor Grothendieck
ggrothendieck at gmail.com
Fri Mar 2 16:48:52 CET 2007
Please read the last line of every message to r-help and follow it when
posting. You ought to have provided small examples for A and B and
the result.
The following lists every row in z that is at a date in zs or is up to
4 rows later:
library(zoo)
z <- zoo(matrix(101:148, 24), 2001:2024)
zs <- z[c(1, 3, 10)]
z[unique(c(sapply(match(time(zs), time(z)), seq, length = 5)))]
On 3/1/07, Alfonso Sammassimo <cincinattikid at bigpond.com> wrote:
> Dear List,
>
> Sorry if I'm overlooking something simple here but I have gotten a bit
> tangled.
>
> I am trying to print the next five values(with their dates), which occur
> after a certain condition is met.
>
> I have a series of data in zoo format, call it "A". From this series I have
> created a subset (also in zoo format) based on a certain condition, call
> this series "B".
>
> I want to use the dates from "B" as an index, so as each of these dates
> occur in "A", the succeeding five rows from "A" after this date are printed
> out.
>
More information about the R-help
mailing list