left_join.: Join two data.tables together

Description Usage Arguments Value Examples

View source: R/join.R

Description

Join two data.tables together

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
left_join.(x, y, by = NULL)

inner_join.(x, y, by = NULL)

right_join.(x, y, by = NULL)

full_join.(x, y, by = NULL, suffix = c(".x", ".y"))

anti_join.(x, y, by = NULL)

semi_join.(x, y, by = NULL)

Arguments

x

A data.frame or data.table

y

A data.frame or data.table

by

A character vector of variables to join by. If NULL, the default, the join will do a natural join, using all variables with common names across the two tables.

suffix

Append created for duplicated column names when using full_join.()

Value

A data.table

Examples

1
2
3
4
5
6
7
8
df1 <- data.table(x = c("a","a","a","b","b"), y = 1:5)
df2 <- data.table(x = c("a","b"), z = 1:2)

df1 %>% left_join.(df2)
df1 %>% inner_join.(df2)
df1 %>% right_join.(df2)
df1 %>% full_join.(df2)
df1 %>% anti_join.(df2)

mtfairbanks/gdt documentation built on May 4, 2021, 9:44 a.m.