left_join.dtplyr_step {dtplyr} | R Documentation |
Join data tables
Description
These are methods for the dplyr generics left_join()
, right_join()
,
inner_join()
, full_join()
, anti_join()
, and semi_join()
. Left, right,
inner, and anti join are translated to the [.data.table
equivalent,
full joins to data.table::merge.data.table()
.
Left, right, and full joins are in some cases followed by calls to
data.table::setcolorder()
and data.table::setnames()
to ensure that column
order and names match dplyr conventions.
Semi-joins don't have a direct data.table equivalent.
Usage
## S3 method for class 'dtplyr_step'
left_join(x, y, ..., by = NULL, copy = FALSE, suffix = c(".x", ".y"))
Arguments
x , y |
A pair of |
... |
Other parameters passed onto methods. |
by |
A join specification created with If To join on different variables between To join by multiple variables, use a
For simple equality joins, you can alternatively specify a character vector
of variable names to join by. For example, To perform a cross-join, generating all combinations of |
copy |
If |
suffix |
If there are non-joined duplicate variables in |
Examples
library(dplyr, warn.conflicts = FALSE)
band_dt <- lazy_dt(dplyr::band_members)
instrument_dt <- lazy_dt(dplyr::band_instruments)
band_dt %>% left_join(instrument_dt)
band_dt %>% right_join(instrument_dt)
band_dt %>% inner_join(instrument_dt)
band_dt %>% full_join(instrument_dt)
band_dt %>% semi_join(instrument_dt)
band_dt %>% anti_join(instrument_dt)