n_unique: Count Unique Values

View source: R/utils.R

n_uniqueR Documentation

Count Unique Values

Description

Internal helper to count the number of distinct values in a vector. Works for numeric, character, and factor vectors.

Usage

n_unique(x, na.rm = FALSE)

Arguments

x

A vector.

na.rm

Logical (default FALSE). If TRUE, missing values (NA) are removed before counting.

Value

Integer. The number of unique values in x (including NA as one distinct value when na.rm = FALSE).


biometryassist documentation built on Feb. 3, 2026, 5:06 p.m.