How to remove repeated elements in a vector, similar to 'set' in Python
You can check out unique
function.
> v = c(1, 1, 5, 5, 2, 2, 6, 6, 1, 3)
> unique(v)
[1] 1 5 2 6 3
This does the same thing. Slower, but useful if you also want a logical vector of the duplicates:
v[duplicated(v)]