Skip to contents

Number of unique elements in a vector

Usage

NrUnique(x, na.rm = TRUE)

Arguments

x

object of type vector.

na.rm

logical indicating if missing values have to be removed. Default to TRUE.

Value

vector with the number of unique elements

Examples

set.seed(1)
x = sample(letters, 50, TRUE)
NrUnique(x)
#> [1] 22