```r x1 = c("b", "c", "a") x2 = c("a", "c") intersect(x1, x2) fintersect(data.table(x = x1), data.table(x = x2))$x ``` The result is ordered according to the 2nd argument while R's `intersect()` preserves the order of the first argument.
The result is ordered according to the 2nd argument while R's
intersect()preserves the order of the first argument.