Hi CecĂlia, Assuming that you want to pair two samples as more as possible, let's relabel the k1 indices. The x$k1 c(1,1,2,3,3,5) could be relabeled as c(1.01,1.02,2.01,3.01,3.02,5.01), so as y$k1.
x$k1 <- x$k1+sequence(rle(x$k1)$lengths)/100 y$k1 <- y$k1+sequence(rle(y$k1)$lengths)/100 merge(x,y,by="k1") Regards, Wu ----- A R learner. -- View this message in context: http://r.789695.n4.nabble.com/paired-samples-matching-rows-merge-tp2332352p2332402.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.