[R] identify number of sequences from a vector

Ravi Varadhan rvaradhan at jhmi.edu
Tue Oct 9 17:36:55 CEST 2007


Try:

help.search("run")

Ravi.

----------------------------------------------------------------------------
-------

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: rvaradhan at jhmi.edu

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

 

----------------------------------------------------------------------------
--------


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On
Behalf Of roger koenker
Sent: Tuesday, October 09, 2007 11:26 AM
To: marc_schwartz at comcast.net
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] identify number of sequences from a vector

this  seems to be a good candidate for a \concept{} entry
since it is it is not found by

	help.search("runs")

on R version 2.6.0 Under development (unstable) (2007-09-03 r42749).


url:    www.econ.uiuc.edu/~roger            Roger Koenker
email    rkoenker at uiuc.edu            Department of Economics
vox:     217-333-4558                University of Illinois
fax:       217-244-6678                Champaign, IL 61820


On Oct 9, 2007, at 9:41 AM, Marc Schwartz wrote:

> O
>
> Look at ?rle
>
> Example:
>
>> Vec
>  [1] 1 1 1 0 0 1 1 1 1 1 1
>
>> rle(Vec)
> Run Length Encoding
>   lengths: int [1:3] 3 2 6
>   values : num [1:3] 1 0 1
>
>> length(rle(Vec)$lengths)
> [1] 3
>
>
> HTH,
>
> Marc Schwartz
>

______________________________________________
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.



More information about the R-help mailing list