A wrapper around dplyr's left_join, with an error message if duplicate values are present in the matching fields in y. This will prevent duplicating rows. See dplyr::left_join .
strict_left_join(x, y, by = NULL, ...)
data frame x (left)
data frame y (right)
unquoted variable names to join.
Pass further arguments to dplyr::left_join
merged data frame
left_df <- data.frame(id = c(1, 2, 3), name = c("Alice", "Bob", "Charlie"))
right_df <- data.frame(id = c(1, 2, 4), age = c(20, 25, 30))
strict_left_join(left_df, right_df, by = "id")
#> id name age
#> 1 1 Alice 20
#> 2 2 Bob 25
#> 3 3 Charlie NA