Learn R Programming

nima (version 0.6.2)

uniqlen: Find Number of Unique Values

Description

Get the number of unique values in an input vector.

Usage

uniqlen(vec, na.rm = TRUE)

Arguments

vec

A vector of any type.

na.rm

If TRUE, remove missing values.

Value

Number of unique values.

Examples

Run this code
# NOT RUN {
x <- c(1, 3, 1, 1, NA, 2, 2, 3, NA, NA, 1, 3, 1)
uniqlen(x)
uniqlen(x, na.rm = FALSE)
# }

Run the code above in your browser using DataLab