[R] a newbie seeking for a simple problem

Daniel Malter daniel at umd.edu
Mon Sep 3 01:26:04 CEST 2012


As df2 has only one column and is thus effectively a variable in this case,
you don't even need to merge.

df1[df1$gene_name%in%df2$gene_name , ] 

should do.

HTH,
Daniel


wong, honkit (Stephen) wrote
> 
> Dear Experienced R users,
> 
> I have a looks-like simple but complicated problem urgently needed to be
> solved. Below is the detail:
> 
> I have two dataframes, df1, df2. df1 contains two column and many
> thousands rows: column 1 is a "gene_name", column 2 is "value". df2
> contains only one column which is "gene_name" with couple hundred rows. I
> want to change "value" of df2 for those "gene_name" also appear in df2
> "gene_name". How to do that? Millions thanks.
> 
> 
> Ste
> 
> ______________________________________________
> R-help@ 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.
> 




--
View this message in context: http://r.789695.n4.nabble.com/a-newbie-seeking-for-a-simple-problem-tp4642029p4642031.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list