[R] Find the first values in vector

Nikhil Kaza nikhil.list at gmail.com
Mon Nov 9 20:59:35 CET 2009


How about

vec[1:min(which(vec==FALSE))-1]

This will return a character(0) vector if vec[1] is FALSE

Nikhil

On 9 Nov 2009, at 2:38PM, David Winsemius wrote:

>> vec= TRUE  TRUE  TRUE  TRUE FALSE FALSE FALSE FALSE TRUE  TRUE  FALSE




More information about the R-help mailing list