Filtering joins filter rows from x based on the presence or absence of matches in y:
semi_join() return all rows from x with a match in y.
anti_join() return all rows from x without a match in y.
# "Filtering" joins keep cases from the LHS
band_members %>% semi_join(band_instruments)
#> Joining, by = "name"
#> # A tibble: 2 x 2
#> name band
#> <chr> <chr>
#> 1 John Beatles
#> 2 Paul Beatles
band_members %>% anti_join(band_instruments)
#> Joining, by = "name"
#> # A tibble: 1 x 2
#> name band
#> <chr> <chr>
#> 1 Mick Stones
semi_join
只返回x表格中中可以跟y表格匹配的行,anti_join
返回x表格中与y表格不匹配的行。