powered by
Finds duplicates from both ends, optionally returns indexes of duplicate groups
Alldups(v, groups = FALSE)
vector
If TRUE, uses as.numeric(as.character(v)) twice to index duplicated groups with natural numbers (and non-duplicated with 0)
Logical vector of length equal to 'v', or numerical vector if 'groups=TRUE'
In short, this is extension of unique() which skips the first duplicate in each group. 'NA' count as duplicate but do not count as duplicate group.
unique
# NOT RUN { aa <- c("one", "two", "", NA, "two", "three", "three", "three", NA, "", "four") Alldups(aa) data.frame(v=aa, dups=Alldups(aa), groups=Alldups(aa, groups=TRUE)) # }
Run the code above in your browser using DataLab