lenuniq {broman} | R Documentation |
Number of unique values
Description
Get the number of unique values in a vector
Usage
lenuniq(vec, na.rm = TRUE)
Arguments
vec |
A vector |
na.rm |
If |
Details
It just does length(unique(vec))
or, if
na.rm=TRUE
(the default)
length(unique(vec[!is.na(vec)]))
Value
Number of unique values.
Examples
x <- c(1, 2, 1, 3, 1, 1, 2, 2, 3, NA, NA, 1)
lenuniq(x)
lenuniq(x, na.rm=FALSE)
[Package broman version 0.84 Index]