Reputation: 9
For simple 1:1 merge for example:
data_merge <- (dataset1, dataset2, by.x = "name", by.y = "name")
Is there a way to run a check of the values successfully merged, i.e., a count or flag of those only in merged into the data set from the dataset1, and those only merged in from dataset2, and those successfully matched from both?
Upvotes: 0
Views: 35
Reputation: 66415
The tidylog
package provides that for dplyr/tidyr operations. For instance,
library(dplyr); library(tidylog)
left_join(band_members, band_instruments)
Result
Joining, by = "name"
left_join: added one column (plays)
> rows only in x 1
> rows only in y (1)
> matched rows 2
> ===
> rows total 3
# A tibble: 3 × 3
name band plays
<chr> <chr> <chr>
1 Mick Stones NA
2 John Beatles guitar
3 Paul Beatles bass
Upvotes: 1