[R] Code to fetch summary info from vector

Stephen Sefick sas0025 at auburn.edu
Tue Jan 15 17:32:53 CET 2013


I don't know if I understand what you want.  What are the periods?  I 
suspect this is a time series.  What have you tried that didn't work?
kind regards,

Stephen

On 01/15/2013 10:16 AM, Benjamin Gillespie wrote:
> Hi all,
>
> Thanks in advance for any help.
>
> I have a vector "b":
>
> b=c(1,1,1,2,3,4,3,2,1,1,1,1,1,2,3,4,5,4,3.5,3,2,1,1,1)
>
> Imagine b is river flow throughout time.
>
> I would like some code that will generate the following information:
>
> number of individual 'periods' where b>1 (= 2 in this case)
> period 1 length = 5, max = 4
> period 2 length = 8, max = 5
>
> I can't figure anything useful out.
>
> Thanks,
> 		
> Ben Gillespie
> Research Postgraduate
>
> School of Geography
> University of Leeds
> Leeds
> LS2 9JT
>
> http://www.geog.leeds.ac.uk/
> ______________________________________________
> R-help at r-project.org 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.

-- 
Stephen Sefick
**************************************************
Auburn University
Biological Sciences
331 Funchess Hall
Auburn, Alabama
36849
**************************************************
sas0025 at auburn.edu
http://www.auburn.edu/~sas0025
**************************************************

Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods.  We are mammals, and have not exhausted the annoying little problems of being mammals.

                                 -K. Mullis

"A big computer, a complex algorithm and a long time does not equal science."

                               -Robert Gentleman



More information about the R-help mailing list