Created
June 7, 2021 22:04
-
-
Save geotheory/9025ba5a662d832cdc265b761147a9da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# remotes::install_github("moodymudskipper/safejoin") | |
require(safejoin) | |
require(tidyverse) | |
#> Loading required package: tidyverse | |
d1 = tibble(id = c(1,2,3), x = c('A','B','C'), y = c(5,7,9)) | |
d2 = tibble(id = c(2,3,4), x = c('B','CC','D'), y = c(7,9,11)) | |
safe_full_join(d1, d2, by = 'id', conflict = ~ coalesce(.y, .x)) | |
#> # A tibble: 4 x 3 | |
#> id x y | |
#> <dbl> <chr> <dbl> | |
#> 1 1 A 5 | |
#> 2 2 B 7 | |
#> 3 3 CC 9 | |
#> 4 4 D 11 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment