safe_join: One-to-one left join

View source: R/safe_join.R

safe_joinR Documentation

One-to-one left join

Description

Just a simple wrapper around dplyr::left_join to stop myself from accidentally many-to-one joining when I don't expect to.

Usage

safe_join(x, y, ...)

Arguments

x, y

tbls to join

...

other arguments to be passed to left_join

Value

a tbl

Note

Saftey first!

Author(s)

Sven Halvorson

Examples

## Not run: 
df1 = tibble(
  x = 1:5,
  y = letters[1:5],
  z = LETTERS[1:5]
)

df2 = tibble(
  x = c(1:4, 4),
  j = LETTERS[5:1]
)

safe_join(df1, df2)
safe_join(df1, df2, by = c('z' = 'j'), suffix = c('_left', '_right'))

## End(Not run)

svenhalvorson/SvenR documentation built on Aug. 25, 2023, 1:31 p.m.