Thanks!
Ill give this a try. I forgot to mention that the SNP.ID is not named the
same in both files, even though they contain the same information. I'll just
go ahead and open one of the files in a text editor and rename the columns
so they match.
-Morassa
PhD Student
Johns Hopkins Human Genetics
-----------
Try looking at ?merge

If your data is in two dataframes df1 and df2:

merge(df1, df2)

(This will merge on SNPID because that column is common to both dataframes).





---

-----Original Message-----

From: [EMAIL PROTECTED]

[*mailto:[EMAIL PROTECTED]<[EMAIL PROTECTED]>]
On Behalf Of Morassa Mohseni

Sent: 24 August 2007 15:41

To: r-help@stat.math.ethz.ch

Subject: [R] Merging two files together in R

Hi,

Thanks in advance for reading this post.

I received some affymetrix genotyping data back recently (250K, Nsp
array)...However, in order for me to do any analysis on this data set, I
need to add append the annotation file to it. Basically I want to do
something that looks like this:





Snpfile(tab delimited):





SNPID Genotype X Y

123 AA 13.4 1.2

456 AB 10.1 12.2

789 BB 2.7 14.4





Annotation file (csv file):





rs#, SNPID, Chromosome

rs23525, 456, 12

rs78423, 123, 4

rs82342, 789, 9





What I am trying to get is an output file that looks like this:





SNPID rs# Chromosome Genotype X

Y

123 rs78423 4 AA

13.4

1.2

456 rs23525 12 AB

10.1

12.2

789 rs82342 9 BB

2.7

14.4









The SNPID is the same in both files so I would like to use that to match
up...but they are not in the same order in both files, so I want to make
sure that I am appending and merging the 2 files correctly. So far all ive
really been able to do is import the files into R...Ive been looking through
the posts, and was wondering if I could use cbind(...) to merge the
files?...not sure though.





Thanks again!!

Morassa Mohseni





PhD Student

Johns Hopkins Dept. of Human Genetics

Baltimore, MD

[[alternative HTML version deleted]]

        [[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
and provide commented, minimal, self-contained, reproducible code.

Reply via email to