Unique values of a factor

fct_unique(f)

Arguments

f

A factor

Examples

f <- factor(letters[rpois(100, 10)]) unique(f) # in order of appearance
#> [1] l h f g d e k j i m q r s n o p #> Levels: d e f g h i j k l m n o p q r s
fct_unique(f) # in order of levels
#> [1] d e f g h i j k l m n o p q r s #> Levels: d e f g h i j k l m n o p q r s