[R] Calculating lengths of runs of 0 or 1 sequences in meteorological data

Detlef Steuer detlef.steuer at hsu-hh.de
Fri Mar 11 12:22:30 CET 2005


Mohammad,

?rle

is your friend, I guess.

Detlef

On Fri, 11 Mar 2005 03:07:56 -0800 (PST)
Mohammad Ehsanul Karim <wildscop at yahoo.com> wrote:

> Dear List Members,
> 
> I need some help about programming in S language. My
> problem is as follows:
> 
> I have meteorological data (about rainfall measurement
> each day from 1989-2002), say like 
> http://www.angelfire.com/ab5/get5/data.rainfall.txt 
> or http://www.angelfire.com/ab5/get5/R.rainfall.txt
> in a sequence of 0(denoting dry day)'s and 1(denoting
> wet day)'s. I want to construct a frequency
> distribution table of various lengths
> (1,2,3,4,5,6,7,8,9,or more) of observed wet spells
> (number of successive 1's) and dry spells (number of
> successive 0's) occurring in data.
> 
> How should i proceed? Is there any existing
> program/function/package to solve such problem (seems
> like the algorithm should be similar to statistical
> run test)?
> 
> Any suggestion, direction, references, help, replies
> will be highly appreciated.
> 
> Thank you for your time.
> 
> _____________________________
> 
> Mohammad Ehsanul Karim
> E-mail: wildscop at yahoo.com
> Web: http://snipurl.com/ehsan
> ISRT, University of Dhaka, BD
> 
> ______________________________________________
> R-help at 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




More information about the R-help mailing list