Set Operations
union, intersect, setdiff and unique treat vectors as sets. %in% tests membership.
Example
a <- c(1, 2, 3); b <- c(3, 4)
print(union(a, b)); print(intersect(a, b)); print(setdiff(a, b))Exercise
Common elements.
(a, b)Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.