View Single Post
Old 10-03-2011, 01:06 PM   #4
ECO
--Site Admin--
 
Location: SF Bay Area, CA, USA

Join Date: Oct 2007
Posts: 1,358
Default

Just need to tell merge what to do...(note I added two extra genes into df1)

Code:
> df1
  Gene Change    Padj
1    1    212 0.00060
2    2     99 0.09000
3    3     15 0.70000
4    4     59 0.45600
5    5    418 0.00001
6    6    566 0.00000
7    7    123 0.00000
8    8    125 0.04000
> df2
  Gene Statistic    FDR
1    1        28 0.0005
2    2        17 0.0070
3    3         3 0.8100
4    4         8 0.2800
5    5        48 0.0020
6    6       111 0.0000
> merge(df1,df2,on=Gene)
  Gene Statistic    FDR Change    Padj
1    1        28 0.0005    212 0.00060
2    2        17 0.0070     99 0.09000
3    3         3 0.8100     15 0.70000
4    4         8 0.2800     59 0.45600
5    5        48 0.0020    418 0.00001
6    6       111 0.0000    566 0.00000
edit: Looks like "on" isn't necessary...something else going on with your data? Merge is pretty smart by default...
ECO is offline   Reply With Quote