9.3 many to one OR one to many
In a many-to-one merge, one of the tables have duplicate keys
(x <- tribble(
~key, ~val_x,
1, "x1",
2, "x2",
3, "x3",
1, "x4",
1, "x5",
1, "x6"
))
## # A tibble: 6 x 2
## key val_x
## <dbl> <chr>
## 1 1 x1
## 2 2 x2
## 3 3 x3
## 4 1 x4
## 5 1 x5
## 6 1 x6
(y <- tribble(
~key, ~val_y,
1, "y1",
2, "y2",
4, "y3"
))
## # A tibble: 3 x 2
## key val_y
## <dbl> <chr>
## 1 1 y1
## 2 2 y2
## 3 4 y3