powered by
Simple wrapper for length(unique(.x)). If you use n_unique_(.x) then NA is ignored when counting.
n_unique(.x, ignore_na = FALSE)n_unique_(.x, ignore_na = TRUE)n_unique_(.x, ignore_na = TRUE)
n_unique_(.x, ignore_na = TRUE)
a single numeric vector of the same length as the data frame it is applied to.
a vector
a logical indicating whether missing values should be removed
vignette("s"), vignette("hablar")
vignette("s")
vignette("hablar")
# Simple n_unique(c(1, 2, 2, 3)) # Same result as above eventhough vector includes NA n_unique_(c(1, 2, 2, 3, NA))
Run the code above in your browser using DataLab