lenuniq | R Documentation |
Get the number of unique values in a vector
lenuniq(vec, na.rm = TRUE)
vec |
A vector |
na.rm |
If |
It just does length(unique(vec))
or, if
na.rm=TRUE
(the default)
length(unique(vec[!is.na(vec)]))
Number of unique values.
x <- c(1, 2, 1, 3, 1, 1, 2, 2, 3, NA, NA, 1)
lenuniq(x)
lenuniq(x, na.rm=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.