n_distinct {plyranges}R Documentation

Compute the number of distinct unique values in a vector or List

Description

This is a wrapper to length(unique(x)) or lengths(unique(x)) if x is a List object

Usage

n_distinct(var)

Arguments

var

a vector of values

Value

an integer vector

Examples

x <- CharacterList(c("a", "b", "c", "a"),  "d")
n_distinct(x)
n_distinct(unlist(x))


[Package plyranges version 1.4.1 Index]