[R] Extract indices after comparing two vectors

2011-04-18 Thread Chee Chen
Dear All, I would like to ask a question about how to locate the indices after comparing two numeric vectors. Say, I have, A - c(1,2,3,4) and A - c(0,3,1,5) and we cmpare: idx - AB So: idx [1] FALSE TRUE FALSE TRUE Question 1: I would like to get a vector that stores the indices for

Re: [R] Extract indices after comparing two vectors

2011-04-18 Thread Phil Spector
?which A - c(1,2,3,4) B - c(0,3,1,5) which(AB) max(which(AB)) [1] 4 - Phil Spector Statistical Computing Facility Department of Statistics