left_join | R Documentation |
Join two data.tables together
left_join(x, y, by = NULL, suffix = c(".x", ".y"), ..., keep = FALSE)
right_join(x, y, by = NULL, suffix = c(".x", ".y"), ..., keep = FALSE)
inner_join(x, y, by = NULL, suffix = c(".x", ".y"), ..., keep = FALSE)
full_join(x, y, by = NULL, suffix = c(".x", ".y"), ..., keep = FALSE)
anti_join(x, y, by = NULL)
semi_join(x, y, by = NULL)
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 |
... |
Other parameters passed on to methods |
keep |
Should the join keys from both |
df1 <- data.table(x = c("a", "a", "b", "c"), y = 1:4)
df2 <- data.table(x = c("a", "b"), z = 5:6)
df1 %>% left_join(df2)
df1 %>% inner_join(df2)
df1 %>% right_join(df2)
df1 %>% full_join(df2)
df1 %>% anti_join(df2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.