left_join_m: left_join with messages

View source: R/left_join_m.R

left_join_mR Documentation

left_join with messages

Description

This function runs left_join and provides information on match type (1:1, 1:m, m:1, m:m) and the number of unmatched rows in the left tibble.

Usage

left_join_m(x, y, by = NULL, ...)

Examples

library(tidyverse)
band_members %>% left_join_m(band_instruments)
band_members %>% left_join_m(band_instruments, by = "name")
band_members %>% left_join_m(band_instruments2, by = c("name" = "artist"))

# The following is based on https://stackoverflow.com/questions/26611717/can-dplyr-join-on-multiple-columns-or-composite-key

library(dplyr)

d1 <- tibble(
  x = letters[1:3],
  y = LETTERS[1:3],
  a = rnorm(3)
)

d2 <- tibble(
  x2 = c("a","b","b"),
  y2 = c("B"),
  b = rnorm(3)
)

left_join_m(d1, d2, by = c("x" = "x2", "y" = "y2"))

d1 <- tibble(
  x = c("a","b","b"),
  y = c("B"),
  a = rnorm(3)
)

d2 <- tibble(
  x2 = letters[1:3],
  y2 = LETTERS[1:3],
  b = rnorm(3)
)

left_join_m(d1, d2, by = c("x" = "x2", "y" = "y2"))

sleeubc/sanghoon documentation built on April 10, 2022, 5:30 p.m.