Description Usage Arguments Examples
See join
for a description of the general purpose of the
functions.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | ## S3 method for class 'tbl_df'
inner_join(x, y, by = NULL, copy = FALSE,
suffix = c(".x", ".y"), ...)
## S3 method for class 'tbl_df'
left_join(x, y, by = NULL, copy = FALSE, suffix = c(".x",
".y"), ...)
## S3 method for class 'tbl_df'
right_join(x, y, by = NULL, copy = FALSE,
suffix = c(".x", ".y"), ...)
## S3 method for class 'tbl_df'
full_join(x, y, by = NULL, copy = FALSE, suffix = c(".x",
".y"), ...)
## S3 method for class 'tbl_df'
semi_join(x, y, by = NULL, copy = FALSE, ...)
## S3 method for class 'tbl_df'
anti_join(x, y, by = NULL, copy = FALSE, ...)
|
x |
tbls to join |
y |
tbls to join |
by |
a character vector of variables to join by. If To join by different variables on x and y use a named vector.
For example, |
copy |
If |
suffix |
If there are non-joined duplicate variables in |
... |
included for compatibility with the generic; otherwise ignored. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | if (require("Lahman")) {
batting_df <- tbl_df(Batting)
person_df <- tbl_df(Master)
uperson_df <- tbl_df(Master[!duplicated(Master$playerID), ])
# Inner join: match batting and person data
inner_join(batting_df, person_df)
inner_join(batting_df, uperson_df)
# Left join: match, but preserve batting data
left_join(batting_df, uperson_df)
# Anti join: find batters without person data
anti_join(batting_df, person_df)
# or people who didn't bat
anti_join(person_df, batting_df)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.