n_distinct {poorman}R Documentation

Count the number of unique values in a set of vectors

Description

This is the equivalent of length(unique(x)) for multiple vectors.

Usage

n_distinct(..., na.rm = FALSE)

Arguments

...

Vectors of values.

na.rm

logical(1). If TRUE missing values don't count.

Examples

x <- sample(1:10, 1e5, rep = TRUE)
length(unique(x))
n_distinct(x)


[Package poorman version 0.2.7 Index]