I know I can get the index of duplicates using duplicated
in R. But I wonder how to get the index of all instances of a duplicate in the entire vector?
As a trivial example, if 1, 7
are duplicates, how to get the indices of theses values all over the vector?
a = c(1, 7, 5, 7, 4, 1)
duplicated(a)
Desired output:
c(T, T, F, T, F, T)