Hi

Change V1 for the name of the column to be matched on X and Y

cbind(X,Y[match(X$V1,Y$V1),])

Neurorox


>From: "yohannes alazar" <[EMAIL PROTECTED]>
>To: r-help@stat.math.ethz.ch
>Subject: [R] managing data
>Date: Sat, 17 Jun 2006 14:40:47 +0100
>
>Dear mailing list, may some one be kind to help me solve following problem.
>
>I am trying to write a code that will combine two tables "x" and "y". The
>first columns of both tables are unique identification for the rows. The
>first column of table "X" is a sub set of the first column of "Y". I need 
>to
>find the matching rows in both tables by looking on their unique
>identification at the first columns. Table is "X" is (19010 rw, 6 col) and
>"Y" is (19850 rw, 9 col). Therefore my out put need to be "Z" is 
>(19010rw,15
>col). A small example of my input and out put is here below.
>
>
>Thank you in advance!
>
>
>input
>Table"X""
>
>A,1,2,2
>B,2,1,1
>C,1,2,2
>E,2,2,1
>F,2,1,1
>H,1,2,2
>J,2,1,1
>K,2,1,1
>
>Table"Y"
>
>A,GG,CG,
>B,CC,TC,
>C,CA,AA,
>D,AT,TT,
>E,AA,AA,
>F,CG,CG,
>G,CC,CC,
>H,GG,GT,
>I,GT,TT,
>J,AA,AT,
>K,AC,CC,
>
>output
>Table"Z""
>
>A,1,2,2,A,GG,CG,
>B,2,1,1,B,CC,TC,
>C,1,2,2,C,CA,AA,
>E,2,2,1,E,AA,AA,
>F,2,1,1,F,CG,CG,
>H,1,2,2,H,GG,GT,
>J,2,1,1,J,AA,AT,
>K,2,1,1,K,AC,CC,
>
>  Regards Hannes
>
>       [[alternative HTML version deleted]]
>
>______________________________________________
>R-help@stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! 
>http://www.R-project.org/posting-guide.html

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to