Set comparisons
Usage
isSubset(x, y)
isSuperset(x, y)
areDisjointSets(x, y)
areIntersectingSets(x, y)
areSetEqual(x, y)
See also
assertive.sets::is_subset()
.assertive.sets::is_superset()
.assertive.sets::are_disjoint_sets()
.assertive.sets::are_intersecting_sets()
.assertive.sets::are_set_equal()
.
Examples
## TRUE ====
isSubset(x = "a", y = c("a", "b"))
#> [1] TRUE
## This assert is particularly useful for checking required columns.
isSuperset(
x = colnames(datasets::ChickWeight),
y = c("Time", "weight", "Diet")
)
#> [1] TRUE
areDisjointSets(x = c("a", "b"), y = c("c", "d"))
#> [1] TRUE
areIntersectingSets(x = c("a", "b"), y = c("b", "c"))
#> [1] TRUE
areSetEqual(x = c("a", "b"), y = c("b", "a"))
#> [1] TRUE
## FALSE ====
isSubset(x = "c", y = c("a", "b"))
#> [1] FALSE
isSuperset(
x = c("Time", "weight", "Diet"),
y = colnames(datasets::ChickWeight)
)
#> [1] FALSE
areDisjointSets(x = c("a", "b"), y = c("b", "a"))
#> [1] FALSE
areIntersectingSets(x = c("a", "b"), y = c("c", "d"))
#> [1] FALSE
areSetEqual(x = c("a", "b"), y = c("b", "c"))
#> [1] FALSE