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