Dear Stefan,

You could use rbind.fill() from reshape package :

> install.packages("reshape")
> library(reshape)
> 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"))
> rbind.fill(df1, df2)
  A    B       C
1 1    m at home
2 2    f    away
3 2 <NA> at home

2008/12/11 Stefan Uhmann <stefan.uhmann@mailbox.tu-dresden.de>

> 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.
>

	[[alternative HTML version deleted]]

