[R] how to find the location of the first TRUE of a logical vector
Roger Peng
rpeng at stat.ucla.edu
Wed Mar 5 23:19:54 CET 2003
Try,
x <- c(F,F,F,T,F,T,F,T)
min(which(x))
-roger
_______________________________
UCLA Department of Statistics
rpeng at stat.ucla.edu
http://www.stat.ucla.edu/~rpeng
On Wed, 5 Mar 2003, Jason Liao wrote:
> without having to check the vector element by element? Thanks a lot!
>
> Jason
>
> =====
> Jason G. Liao, Ph.D.
> Division of Biometrics
> University of Medicine and Dentistry of New Jersey
> 335 George Street, Suite 2200
> New Brunswick, NJ 08903-2688
> phone (732) 235-8611, fax (732) 235-9777
> http://www.geocities.com/jg_liao
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>
More information about the R-help
mailing list