Repository navigation
Expand file tree
/
Copy pathjoin.tbl_df.Rd
More file actions
137 lines (117 loc) · 3.7 KB
/
Copy pathjoin.tbl_df.Rd
File metadata and controls
137 lines (117 loc) · 3.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/dataframe.R, R/tbl-df.r
\name{nest_join.data.frame}
\alias{nest_join.data.frame}
\alias{join.tbl_df}
\alias{inner_join.tbl_df}
\alias{nest_join.tbl_df}
\alias{left_join.tbl_df}
\alias{right_join.tbl_df}
\alias{full_join.tbl_df}
\alias{semi_join.tbl_df}
\alias{anti_join.tbl_df}
\title{Join data frame tbls}
\usage{
\method{nest_join}{data.frame}(x, y, by = NULL, copy = FALSE, keep = FALSE, name = NULL, ...)
\method{inner_join}{tbl_df}(
x,
y,
by = NULL,
copy = FALSE,
suffix = c(".x", ".y"),
...,
na_matches = pkgconfig::get_config("dplyr::na_matches")
)
\method{nest_join}{tbl_df}(x, y, by = NULL, copy = FALSE, keep = FALSE, name = NULL, ...)
\method{left_join}{tbl_df}(
x,
y,
by = NULL,
copy = FALSE,
suffix = c(".x", ".y"),
...,
na_matches = pkgconfig::get_config("dplyr::na_matches")
)
\method{right_join}{tbl_df}(
x,
y,
by = NULL,
copy = FALSE,
suffix = c(".x", ".y"),
...,
na_matches = pkgconfig::get_config("dplyr::na_matches")
)
\method{full_join}{tbl_df}(
x,
y,
by = NULL,
copy = FALSE,
suffix = c(".x", ".y"),
...,
na_matches = pkgconfig::get_config("dplyr::na_matches")
)
\method{semi_join}{tbl_df}(
7B93
div>
x,
y,
by = NULL,
copy = FALSE,
...,
na_matches = pkgconfig::get_config("dplyr::na_matches")
)
\method{anti_join}{tbl_df}(
x,
y,
by = NULL,
copy = FALSE,
...,
na_matches = pkgconfig::get_config("dplyr::na_matches")
)
}
\arguments{
\item{x}{tbls to join}
\item{y}{tbls to join}
\item{by}{a character vector of variables to join by. If \code{NULL}, the
default, \verb{*_join()} will do a natural join, using all variables with
common names across the two tables. A message lists the variables so
that you can check they're right (to suppress the message, simply
explicitly list the variables that you want to join).
To join by different variables on x and y use a named vector.
For example, \code{by = c("a" = "b")} will match \code{x.a} to
\code{y.b}.}
\item{copy}{If \code{x} and \code{y} are not from the same data source,
and \code{copy} is \code{TRUE}, then \code{y} will be copied into the
same src as \code{x}. This allows you to join tables across srcs, but
it is a potentially expensive operation so you must opt into it.}
\item{keep}{If \code{TRUE} the by columns are kept in the nesting joins.}
\item{name}{the name of the list column nesting joins create. If \code{NULL} the name of \code{y} is used.}
\item{...}{included for compatibility with the generic; otherwise ignored.}
\item{suffix}{If there are non-joined duplicate variables in \code{x} and
\code{y}, these suffixes will be added to the output to disambiguate them.
Should be a character vector of length 2.}
\item{na_matches}{Use \code{"never"} to always treat two \code{NA} or \code{NaN} values as
different, like joins for database sources, similarly to
\code{merge(incomparables = FALSE)}.
The default, \code{"na"}, always treats two \code{NA} or \code{NaN} values as equal, like \code{\link[=merge]{merge()}}.
Users and package authors can change the default behavior by calling
\code{pkgconfig::set_config("dplyr::na_matches" = "never")}.}
}
\description{
See \link{join} for a description of the general purpose of the
functions.
}
\examples{
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)
}
}