Efficiently count the number of unique values in a set of vectors
This is a faster and more concise equivalent of length(unique(x))
n_distinct(..., na.rm = FALSE)
... |
vectors of values |
na.rm |
if |
x <- sample(1:10, 1e5, rep = TRUE) length(unique(x)) n_distinct(x)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.