dot-unique_and_sorted: ARD-flavor of unique()

.unique_and_sortedR Documentation

ARD-flavor of unique()

Description

Essentially a wrapper for unique(x) |> sort() with NA levels removed. For factors, all levels are returned even if they are unobserved. Similarly, logical vectors always return c(TRUE, FALSE), even if both levels are not observed.

Usage

.unique_and_sorted(x, useNA = c("no", "always"))

Arguments

x

(any)
a vector

Value

a vector

Examples

cards:::.unique_and_sorted(factor(letters[c(5, 5:1)], levels = letters))

cards:::.unique_and_sorted(c(FALSE, TRUE, TRUE, FALSE))

cards:::.unique_and_sorted(c(5, 5:1))

cardx documentation built on Sept. 11, 2024, 9:12 p.m.