If I have a vector:
x <- c(5, 6, 2, 9, 5, 2, 1, 9, 9)
How can I make another vector that contains elements that were never repeated? In this case it would be: c(6, 1) (because 5, 2, and 9 are repeated)
If I have a vector:
x <- c(5, 6, 2, 9, 5, 2, 1, 9, 9)
How can I make another vector that contains elements that were never repeated? In this case it would be: c(6, 1) (because 5, 2, and 9 are repeated)
vector.a <- c(5, 6, 2, 9, 5, 2, 1, 9, 9)
not.reap <- NULL
for (i in 1:length(vector.a)){
not.reap[i] <- !(vector.a[i] %in% vector.a[-i])
}
vector.a[not.reap]