Tsallaka zuwa abun ciki
Justice Tech School

Set Operations

union, intersect, setdiff and %in% work on vectors.

Example
a <- c(1, 2, 3, 4); b <- c(3, 4, 5)
print(union(a, b))
print(intersect(a, b))
print(setdiff(a, b))
print(a %in% b)
print(unique(c(1, 1, 2)))

Exercise

Membership.

a  b

Quiz Test

What does %in% return?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.