Last active
December 21, 2015 23:49
-
-
Save andilabs/6385254 to your computer and use it in GitHub Desktop.
MERGE-ing (pasting) two data frames in R: all=FALSE if you want INTERSECTION (common part of both) as a result all=TRUE if you want SUM (differences fullfiled with NA) as a result http://stat.ethz.ch/R-manual/R-devel/library/base/html/merge.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> authors | |
surname nationality deceased | |
1 Tukey US yes | |
2 Venables Australia no | |
3 Tierney US no | |
4 Ripley UK no | |
5 McNeil Australia no | |
> books | |
name title other.author | |
1 Tukey Exploratory Data Analysis <NA> | |
2 Venables Modern Applied Statistics ... Ripley | |
3 Tierney LISP-STAT <NA> | |
4 Ripley Spatial Statistics <NA> | |
5 Ripley Stochastic Simulation <NA> | |
6 McNeil Interactive Data Analysis <NA> | |
7 R Core An Introduction to R Venables & Smith | |
> authors_books<-merge(authors,books,by.x="surname",by.y="name",all=TRUE) | |
> authors_books | |
surname nationality deceased title other.author | |
1 McNeil Australia no Interactive Data Analysis <NA> | |
2 R Core <NA> <NA> An Introduction to R Venables & Smith | |
3 Ripley UK no Spatial Statistics <NA> | |
4 Ripley UK no Stochastic Simulation <NA> | |
5 Tierney US no LISP-STAT <NA> | |
6 Tukey US yes Exploratory Data Analysis <NA> | |
7 Venables Australia no Modern Applied Statistics ... Ripley | |
> authors_books<-merge(authors,books,by.x="surname",by.y="name",all=FALSE) | |
> authors_books | |
surname nationality deceased title other.author | |
1 McNeil Australia no Interactive Data Analysis <NA> | |
2 Ripley UK no Spatial Statistics <NA> | |
3 Ripley UK no Stochastic Simulation <NA> | |
4 Tierney US no LISP-STAT <NA> | |
5 Tukey US yes Exploratory Data Analysis <NA> | |
6 Venables Australia no Modern Applied Statistics ... Ripley |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment