little question
On Thu, 26 Apr 2001, Olivier Martin wrote:
Hi all, i have a little pb but i don t find how i can solve it.. this is.. i have two vectors x and yn and they don t have the same length... (i suppose length(x)>length(y)) this is what i want to do. i suppose that x=c(10,1,2,3,7,9,1,4,2,11,2,10) and y=c(1,2,4,10) i want to find all the numbers of rows i of x for which x[i] exists in y ... i.e. in this case ...rep=(1,2,3,7,8,9,11,12)
which(x %in% y) -thomas Thomas Lumley Asst. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._