On 07 Aug 2014, at 11:16 , jim holtman <[email protected]> wrote:

> rle

...with a little tinkering, like

> m <- c(1,cumsum(rle(a)$lengths)+1)
> m
[1]  1  4  6 12 16 18 23 34

then look at every 2nd element, discarding the last.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: [email protected]  Priv: [email protected]

______________________________________________
[email protected] 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.

Reply via email to