Re: [R] managing data

From: Neuro LeSuperHéros <neuro3000_at_hotmail.com>
Date: Sun 18 Jun 2006 - 01:56:37 EST


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" <hannesalazar@gmail.com>
>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 Received on Sun Jun 18 02:01:38 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sun 18 Jun 2006 - 04:11:09 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.