set
Set - In mathematics, a set is a well-defined collection of distinct objects. Notation often uses curly braces:
Key points:
- No repeated elements: sets ignore duplicates.
- Can contain any type of object, even other sets.
R demonstration:
library(data.table)
A <- c(1,2,3)
B <- c(3,4,5)
intersect(A,B)
## [1] 3
union(A,B)
## [1] 1 2 3 4 5
Comments
Please log in to leave a comment.
Loading comments...