[R] how to find the location of the first TRUE of a logical vector

J.R. Lockwood lockwood at rand.org
Wed Mar 5 23:41:44 CET 2003


> >
> >without having to check the vector element by element? Thanks a lot!

which.max() will coerce the logical to numeric and give the location of
the first max, which is the first TRUE.

J.R. Lockwood
412-683-2300 x4941
lockwood at rand.org
http://www.rand.org/methodology/stat/members/lockwood/



More information about the R-help mailing list