join: Joins

Description Usage Arguments Value Examples

Description

Full join: join two data frames preserving all possible information

Left join: Join two data frames by matching the second (right) data frame to the left (first) such that the structure of the first (left) data frame is preserved

Right join: Join two data frames by matching the first (left) data frame to the right (second) such that the structure of the second (right) data frame is preserved

Usage

1
2
3
4
5

Arguments

x

Left or first data frame

y

Right or second data frame

by

Name (character) of variable(s) on which to join

Value

Joined (merged) data frame

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
d1 <- tbl_data(
  x = 1:10,
  y = rnorm(10),
  z = letters[1:10]
)
d2 <- tbl_data(
  x = sample(1:10, 20, replace = TRUE),
  y2 = rnorm(20)
)

## left join
left_join_data(d1, d2)

## right join
right_join_data(d1, d2)

## full join
full_join_data(d1, d2)

mkearney/tbltools documentation built on May 14, 2019, 4:02 a.m.