[R] Union of two data frames

Kartik Pappu kartik.pappu at gmail.com
Wed Sep 20 00:30:51 CEST 2006


Hi all,

I have two data frames each with 5 columns and different number of
rows.  some of the row names in one data frame are the same as the row
names in the other.  I want to be able to merge the two data frames to
get a new data frame in which the duplicated row names are only shown
once with the data for the rest of the columns used from the first
data frame.

for example:

	Pvals	PD
A	0.001	0.99
B	0.02	       0.98
C	0.05	       0.97
D	0.005	0.99

	Pvals	PD
C	0.01	       0.99
D	0.0002	0.98
E	0.05	       0.97
F	0.02	       0.99

Union
	Pvals	PD
A	0.001	0.99
B	0.02	       0.98
C	0.05	       0.97
D	0.005	0.99
E	0.05	       0.97
F	0.02  	0.99

Essentially, I want to make a union of the two data frames. I hope
this question makes sense.

Thanks



More information about the R-help mailing list