Count the number of unique items ion a vector x

count.unique(x)

Arguments

x

a vector

Value

the number of unique items in x.

Author

Murray Jorgensen

Examples

x = c(1, 2, 3)
count.unique(x)
#> [1] 3

x = c(1, 1, 1, 2, 3)
count.unique(x)
#> [1] 3