Skip to contents

Length of vectors unique values (including factors).

Usage

length_unique(x)

Arguments

x

A vector

Value

Integer vector of length 1.

Examples

#----------------------------------------------------------------------------
# length_unique() examples
#----------------------------------------------------------------------------
library(bkmisc)

length_unique(10)
#> [1] 1
length_unique(c(1, 2, 3))
#> [1] 3
length_unique(factor(c("a", "a", "b", "b")))
#> [1] 2