Re: [R] extract certain values from a ts

From: Gabor Grothendieck <ggrothendieck_at_gmail.com>
Date: Tue 24 Oct 2006 - 19:10:08 GMT

On 10/24/06, Gabor Grothendieck <ggrothendieck@gmail.com> wrote:
> # Consider the builtin in nhtemp "ts" series
> # Then the runs below above and below the mean are
> r <- rle(as.vector(nmtemp > mean(nhtemp)))
> r
>
> # with the first and last indexes of each
> # runs being given by:
>
> idx.last <- cumsum(r$lengths)
> idx.first <- idx.last - r$lengths + 1
>
> # and the first and last times of each run being
>
The next statement was supposed to be

tt <- time(nhtemp).

I had started with Nile but then switched to nhtemp since it gave too much output for an example.

> tt <- time(Nile)
> cbind(tt[idx.first], tt[idx.last])
>
>
> On 10/24/06, antonio rodriguez <antonio.raju@gmail.com> wrote:
> > Hi,
> >
> > Having several daily wind speed time series I want to extract those
> > consecutive days over and below certain values (i.e. 5 < x <8) Don't
> > know which funtion to use (aggregate, lapply?) and how to do it.
> >
> > Thanks in advance
> >
> > Antonio
> >
> > ______________________________________________
> > R-help@stat.math.ethz.ch 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.
> >
>



R-help@stat.math.ethz.ch 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. Received on Wed Oct 25 09:13:12 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 24 Oct 2006 - 23:30:13 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.