I need to combine two data frames that look like this: I want to take a common column among data frames and combine them together. Rows in two data frames will be completely different.
abc row1 1 0 1 row2 1 0 1
another data block
dacf row3 1 0 1 1 row4 1 1 0 0
I want the final dataset to look like this
ac row1 1 1 row2 1 1 row3 0 1 row4 1 0
Here is a dput of two data frames
dput(x1) structure(list(d = c(1L, 1L), a = 0:1, c = c(1L, 0L), f = c(1L, 0L)), .Names = c("d", "a", "c", "f"), row.names = c("row3", "row4" ), class = "data.frame") dput(x2) structure(list(a = c(1L, 1L), b = c(0L, 0L), c = c(1L, 1L)), .Names = c("a", "b", "c"), row.names = c("row1", "row2"), class = "data.frame")
source share