[R] Sub-vector
Gabor Grothendieck
ggrothendieck at gmail.com
Wed Mar 29 19:26:55 CEST 2006
Try this:
with(rle(a), any(lengths[values]>1))
On 3/29/06, Wuming Gong <wuming.gong at gmail.com> wrote:
> Dear list,
>
> Given a vector of logical values, say
>
> >a <- c(TRUE,TRUE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,TRUE,TRUE)
>
> Are there any R functions that can tell whether there are two or more
> "TRUE" in a row in this vector?
>
> Thanks,
>
> Wuming
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>
More information about the R-help
mailing list