Re: [R] Consecutive zeros in a vector

2008-04-29 Thread Duncan Murdoch
On 29/04/2008 11:39 AM, Kenn Konstabel wrote: Suppose X is a long vector of integers (typically about 3 elements). Is there an efficient way to detect whether there are at least N consecutive zeros in X, and if yes, where does this occur? for example, suppose X is: ... and N is 10. I wou

[R] Consecutive zeros in a vector

2008-04-29 Thread Kenn Konstabel
Suppose X is a long vector of integers (typically about 3 elements). Is there an efficient way to detect whether there are at least N consecutive zeros in X, and if yes, where does this occur? for example, suppose X is: 1 2 3 4 5 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 4 2 0 1 2 0 0 0 2 2 2 2 2 ... a