Set Operations

Union: AB={ξξA or ξB}

Intersection AB={ξξA and ξB}

Complement: Ac={ξξΩ and ξA}=ΩA

Note the correspondence with logic: or, and, not

Difference: AB={ξξA and ξB}=ABc

A <- c(1,2,3,4,5)
B <- c(2,4,6)
union(A,B)
## [1] 1 2 3 4 5 6
intersect(A,B)
## [1] 2 4
setdiff(A,B)
## [1] 1 3 5