I am looking for a way to remove all duplicate elements from a vector, including the reference element. By reference element I mean the element which is currently used in comparisons, to search for its duplicates. For instance, if we consider this vector:
a = c(1,2,3,3,4,5,6,7,7,8)
I would like to obtain:
b = c(1,2,4,5,6,8)
I am aware of duplicated()
and unique()
but they do not provide the result I am looking for.