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. How can I join the datasets and keep the variables as well as the cases? I am looking forward to your reply. Kind regards Georg
> 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
Kunden <- Kunden_2011 Kunden <- merge(Kunden, Kunden_2012, by = "Debitor", all = TRUE) etc. See ?merge for details. Best, Ista On Wed, Apr 20, 2016 at 2:23 AM, <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. > > How can I join the datasets and keep the variables as well as the cases? > > 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.
Maybe Matching Threads
- Creating variables on the fly
- Capistrano Deploy with SVN over SSH - Network connection closed unexpectedly
- rsync: mkstemp ... No such file or directory mangled dirname
- rsync output -vv differs with dry-run option
- PJSIP: identify endpoint by authentication username?