[R] how to find the location of the first TRUE of a logical vector
jg_liao at yahoo.com
Thu Mar 6 03:42:49 CET 2003
Many thanks to all who replied: Marc Schwartz, Douglas Grove, Spencer
Graves, J.R. Lockwood, Roger Peng, Martina Pavlicova, Steve
Su,james.holtman, Wiener, Matthew, Domijan, Katarina and Douglas Bates.
Let x be the logical vector. The best solution seems to be:
Now my code is much simpler.
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
More information about the R-help