lenuniq: Number of unique values

View source: R/lenuniq.R

lenuniqR Documentation

Number of unique values

Description

Get the number of unique values in a vector

Usage

lenuniq(vec, na.rm = TRUE)

Arguments

vec

A vector

na.rm

If TRUE, remove any missing values

Details

It just does length(unique(vec)) or, if na.rm=TRUE (the default) length(unique(vec[!is.na(vec)]))

Value

Number of unique values.

Examples

x <- c(1, 2, 1, 3, 1, 1, 2, 2, 3, NA, NA, 1)
lenuniq(x)
lenuniq(x, na.rm=FALSE)

broman documentation built on May 29, 2024, 7:18 a.m.

Related to lenuniq in broman...