unique

unique "returns a vector, data frame, or array like x but with duplicate elements/rows removed.

Examples

Given a vector of values, how do I return a vector of values with all duplicates removed?

Click to see solution
vec <- c(1, 2, 3, 3, 3, 4, 5, 5, 6)
unique(vec)
[1] 1 2 3 4 5 6