[R] ask for help

peter dalgaard pdalgd at gmail.com
Thu Aug 7 16:58:36 CEST 2014


On 07 Aug 2014, at 11:16 , jim holtman <jholtman at gmail.com> 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: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list