Dear List,

I have two dataframes with overlapping colnames and want to merge them. Actually, what I want is more similar to rbind, but the dataframes differ in their columns. Here are the examples:

df1 <- data.frame(A = c(1,2), B = c("m","f"), C = c("at home", "away"))
df2 <- data.frame(A = c(2), C = c("at home"))

Here the desired result:

  A B        C
1 1 m  at home
2 2 f     away
3 2 NA at home

Thanks for any help,
Stefan

______________________________________________
R-help@r-project.org 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.

Reply via email to