Outputs a single character with names and counts of each level of the input factor.
Usage
fct_describe(x, max_n = 5, return_ordered = TRUE)
Arguments
- x
factor.
- max_n
Integer: Return counts for up to this many levels.
- return_ordered
Logical: If TRUE, return levels ordered by count, otherwise
return in level order.
Value
Character with level counts.
Examples
if (FALSE) { # \dontrun{
# Small number of levels
fct_describe(iris$Species)
# Large number of levels: show top n by count
x <- factor(sample(letters, 1000, TRUE))
fct_describe(x)
fct_describe(x, 3)
} # }