Checks whether x contains at most maxUnique unique, non-missing
values. Unlike nUnique(), this stops counting as soon as the threshold
is exceeded, which makes it considerably faster for large,
high-cardinality vectors.
Value
a logical of length one: TRUE if x has maxUnique or fewer
unique, non-NA values, FALSE otherwise.
See also
nUnique() for the uncapped count.
Other data.predicate:
flags(),
isDichotomous(),
isEuclid(),
isNumeric(),
isWholeLike(),
isZero(),
nUnique()
Examples
isLowCardinality(c(1, 2, 2, 3, NA))
#> [1] TRUE
isLowCardinality(1:100, maxUnique = 12)
#> [1] FALSE
