It might not be the most elegant, but it works: > foo <- c(F, F, T, F, T, T, F ,T) > c(1:length(foo))[foo][1] [1] 3 >
And if there is no 'T', it returns 'NA' > foo <- c(F, F) > c(1:length(foo))[foo][1] [1] NA Martina -------------------------------------------------------------------------- Department of Statistics Office Phone: (614) 292-1567 1958 Neil Avenue, 304E Cockins Hall FAX: (614) 292-2096 The Ohio State University E-mail: [EMAIL PROTECTED] Columbus, OH 43210-1247 www.stat.ohio-state.edu/~pavlicov 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 > > ______________________________________________ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
