I have a vector with repeated elements, and would like to remove them so that each element appears only once.
In Python I could construct a Set from a vector to achieve
This does the same thing. Slower, but useful if you also want a logical vector of the duplicates:
v[duplicated(v)]