[R] Locate first index

Cezar Augusto de Freitas Anselmo cafa at ime.unicamp.br
Fri Sep 19 20:15:50 CEST 2003


Hi, all. I'd like to know if exists a manner to get the first index where
a condition is attained in a vector. For example,

There is a better solution than 

first.index <- table(subject[corretor==27])[1]

(give me the subject for the first time that corretor is 27)?

Thanks,

========================================
Cezar Freitas (ICQ 109128967)
IMECC - UNICAMP
Campinas, SP - Brasil




More information about the R-help mailing list