Learn R Programming

forcats (version 0.0.0.9000)

fct_count: Count entries in a factor

Description

Count entries in a factor

Usage

fct_count(f, sort = FALSE)

Arguments

f
A factor
sort
If TRUE, sort the result so that most common values float to the top.

Value

A tibble with columns f and n

Examples

Run this code
f <- factor(sample(letters)[rpois(1000, 10)])
table(f)
fct_count(f)
fct_count(f, sort = TRUE)

Run the code above in your browser using DataLab