I\'d like to remove all items that appear more than once in a vector. Specifically, this includes character, numeric and integer vectors. Currently, I\'m using duplica
duplica
You could use a set operation:
d <- c(1,2,3,4,1,5,6,4,2,1) duplicates = d[duplicated(d)] setdiff(d, duplicates) [1] 3 5 6
(Not certain if that is more efficient than the above code but it does seem conceptually cleaner)