[R] Union of two data frames

Gamal Azim ageneticist at yahoo.com
Wed Sep 20 02:31:39 CEST 2006


How about, 

uxy <- union(row.names(x), row.names(y))
ixy <- intersect(row.names(x), row.names(y))

rbind(x[is.element(row.names(x),uxy),], 
y[!is.element(row.names(y),ixy),])

Note, simple rbind'ing of the two frames changes
common row.names.

Gamal



More information about the R-help mailing list