Skip to content
Prev 327163 / 398502 Next

How to search for a sequence(and its combination) inside a vector?

On 20-07-2013, at 18:05, C W <tmrsg11 at gmail.com> wrote:

            
Well how about

sum(a)

or 

b <- rle(a)
sum(b$lengths[b$values])

Berend