
Count entries in a factor
fct_count(f, sort = FALSE, prop = FALSE)
A tibble with columns f
, n
and p
, if prop is TRUE
.
A factor (or character vector).
If TRUE
, sort the result so that the most common values
float to the top.
If TRUE
, compute the fraction of marginal table.
f <- factor(sample(letters)[rpois(1000, 10)])
table(f)
fct_count(f)
fct_count(f, sort = TRUE)
fct_count(f, sort = TRUE, prop = TRUE)
Run the code above in your browser using DataLab