Ha Guillaume, Is this what you are looking for? #--------------- x1<-sample(1:10,5,replace=FALSE) x2<-sample(1:10,100,replace=TRUE) #This tapply(x1,1:5,FUN=function(i){which(x2==i)}) #or this tapply(x1,x1,FUN=function(i){which(x2==i)}) #---------------
Gerrit ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.