Re: [R] grouping by consecutive integers

From: Kevin J Emerson <kemerson_at_uoregon.edu>
Date: Tue 25 Jul 2006 - 02:20:09 EST

Let me clarify one thing that I dont think I made clear in my posting. I am looking for the max, min and median of the indicies, not of the time series frequency counts. I am looking to find the max, min, and median time of peaks in a time series, so i am looking for the information concerning that.

so mostly my question is how to extract the information of max, min, and median of sequential numbers in a vector. I will reword my original posting below.

> > Hello R-helpers!
> >
> > I have a question concerning extracting sequence information from a
> > vector. I have a vector (representing the bins of a time series where
> > the frequency of occurrences is greater than some threshold) where I
> > would like to extract the min, median and max of each group of
> > consecutive numbers in the index vector..
> >
> > For Example:
> >
> > tmp <- c(24,25,29,35,36,37,38,39,40,41,42,43,44,45,46,47,68,69,70,71)
> >
> > I would like to have the max,min,median of the following groups:
> >
> > 24,25 - max = 25, min = 24 median = 24.5
> > 29 max=min=median = 29
> > 35,36,37,38,39,40,41,42,43,44,45,46,47, max = 45 min = 35 etc...
> > 68,69,70,71
> >
> > I would like to be able to perform this for many time series so an
> > automated process would be nice. I am hoping to use this as a peak
> > detection protocol.
> >
> > Any advice would be greatly appreciated,
> > Kevin
> >
> > -----
> > -----
> > Kevin J Emerson
> > Center for Ecology and Evolutionary Biology
> > 1210 University of Oregon
> > Eugene, OR 97403
> > USA
> > kemerson@uoregon.edu
> >
> > ______________________________________________
> > 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 Tue Jul 25 02:34:09 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 25 Jul 2006 - 06:22:12 EST.

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