x = data.table(c(1,2,2,2,3,4,4))
y = data.table(c(2,3,4,4,4,5))
fintersect(x, y) # intersect
fintersect(x, y, all=TRUE) # intersect all
fsetdiff(x, y) # except
fsetdiff(x, y, all=TRUE) # except all
funion(x, y) # union
funion(x, y, all=TRUE) # union all
fsetequal(x, y) # setequal
Run the code above in your browser using DataLab