[R] Finding matches in 2 files

2007-07-26 Thread jenny tan


I have 2 files containing data analysed by 2 different methods. I would like to 
find out which genes appear in both analyses. Can someone show me how to do 
this?
_
[[trailing spam removed]]

[[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.


Re: [R] Finding matches in 2 files

2007-07-26 Thread Christophe Pallier
Maybe 'merge', but your message is wa
First


On 7/26/07, jenny tan [EMAIL PROTECTED] wrote:



 I have 2 files containing data analysed by 2 different methods. I would
 like to find out which genes appear in both analyses. Can someone show me
 how to do this?
 _
 [[trailing spam removed]]

 [[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.




-- 
Christophe Pallier (http://www.pallier.org)

[[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.


Re: [R] Finding matches in 2 files

2007-07-26 Thread Christophe Pallier
Maybe with 'merge', but your message is too vague (see
http://www.catb.org/~esr/faqs/smart-questions.html).

On 7/26/07, jenny tan [EMAIL PROTECTED] wrote:



 I have 2 files containing data analysed by 2 different methods. I would
 like to find out which genes appear in both analyses. Can someone show me
 how to do this?
 _
 [[trailing spam removed]]

 [[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.




-- 
Christophe Pallier (http://www.pallier.org)

[[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.


Re: [R] Finding matches in 2 files

2007-07-26 Thread john seers \(IFR\)
 

Something like:

# Sample data
g1-c(gene1, gene2, gene3, gene4, gene5, gene9, gene10,
geneA)
g2-c(gene6, gene9, gene1, gene2, gene7, gene8, gene9,
gene1, gene10)
df1-cbind(gene=g1, expr=runif(length(g1)))
df2-cbind(gene=g2, expr=runif(length(g2)))

# Merge
mdf-merge(df1, df2, by=gene, sort=T)
# Unique list
ug-unique(mdf[,gene])


You may find the match command useful and/or the %in% opertaor.


JS 




 
---
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of jenny tan
Sent: 26 July 2007 04:35
To: r-help@stat.math.ethz.ch
Subject: [R] Finding matches in 2 files



I have 2 files containing data analysed by 2 different methods. I would
like to find out which genes appear in both analyses. Can someone show
me how to do this?
_
[[trailing spam removed]]

[[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.

__
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.


Re: [R] Finding matches in 2 files

2007-07-26 Thread jim holtman
Is this what you want?

 g1-c(gene1, gene2, gene3, gene4, gene5, gene9, gene10,
+ geneA)
 g2-c(gene6, gene9, gene1, gene2, gene7, gene8, gene9,
+ gene1, gene10)
 intersect(g1,g2)
[1] gene1  gene2  gene9  gene10


On 7/25/07, jenny tan [EMAIL PROTECTED] wrote:


 I have 2 files containing data analysed by 2 different methods. I would like 
 to find out which genes appear in both analyses. Can someone show me how to 
 do this?
 _
 [[trailing spam removed]]

[[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.



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
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.