hello cecilia,
i tried:
yn<-y[y$k1%in%x$k1,]
xn<-x[x$k1%in%y$k1,]
x1st<-unique(match(yn$k1,xn$k1))
y1st<-unique(match(xn$k1,yn$k1))
new<-cbind(k1=intersect(y$k1,x$k1),k2.x=xn[x1st,2],k2.y=yn[y1st,2])
giving:
k1 k2.x k2.y
[1,] 1 20 10
[2,] 2 22 12
[3,] 3 23 14
[4,] 5 25 16
...but wih the irregulary duplicated values in k1 i dead-ended and i guess
it could get tricky to solve this.
greetings,
kay
-----
------------------------
Kay Cichini
Postgraduate student
Institute of Botany
Univ. of Innsbruck
------------------------
--
View this message in context:
http://r.789695.n4.nabble.com/paired-samples-matching-rows-merge-tp2332352p2332427.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
[email protected] 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.