[R] Merging Data Sets with Full Outer Join
David Winsemius
dwinsemius at comcast.net
Wed Apr 20 21:44:39 CEST 2016
> On Apr 19, 2016, at 11:23 PM, G.Maubach at weinwolf.de wrote:
>
> Hi All,
>
> I would like to match some datasets. Both deliver variables AND cases
> which might or might not be present in all datasets:
>
> This sequence
>
> Kunden <- Kunden_2011
> Kunden <- merge(Kunden, Kunden_2012,
> by.x = "Debitor", by.y = "Debitor")
>
> Kunden <- merge(Kunden, Kunden_2013,
> by.x = "Debitor", by.y = "Debitor")
>
> Kunden <- merge(Kunden, Kunden_2014,
> by.x = "Debitor", by.y = "Debitor")
>
> Kunden <- merge(Kunden, Kunden_2015,
> by.x = "Debitor", by.y = "Debitor")
>
> delivers too few cases. So I guess it does an equi-join.
You should not be guessing. Read the help page. It calls the default setting a natural join.
>
> How can I join the datasets and keep the variables as well as the cases?
>
If you want a full outer join use all=TRUE. This, too, should have been in the ?merge help page.
> I am looking forward to your reply.
>
> Kind regards
>
> Georg
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
David Winsemius
Alameda, CA, USA
More information about the R-help
mailing list