Try either of these: rbind(DF1, DF2[setdiff(rownames(DF2), rownames(DF1)),])
rbind(DF1, DF2[!(rownames(DF2) %in% rownames(DF1)),]) On 9/19/06, Kartik Pappu <[EMAIL PROTECTED]> wrote: > 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 > > ______________________________________________ > [email protected] 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. > ______________________________________________ [email protected] 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.
