Try this: with(rle(a), any(lengths[values]>1))
On 3/29/06, Wuming Gong <[EMAIL PROTECTED]> 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 > > ______________________________________________ > [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 > ______________________________________________ [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
