n_distinct: Count the number of unique values in a set of vectors

Description Usage Arguments Examples

View source: R/n_distinct.R

Description

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

Usage

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

Arguments

...

Vectors of values.

na.rm

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

Examples

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

poorman documentation built on March 28, 2021, 5:05 p.m.