A wrapper around dplyr::count()
with sort
set to TRUE
by default and
the an additional column created by default containing the proportional
fraction each observation makes of the whole.
count2(x, ..., wt = NULL, sort = TRUE, prop = TRUE, sum = NULL)
count_vec(x, sort = TRUE, prop = TRUE, sum = NULL)
A tibble of element counts
count2(iris, Species)
#> # A tibble: 3 × 3
#> Species n p
#> <fct> <int> <dbl>
#> 1 setosa 50 0.333
#> 2 versicolor 50 0.333
#> 3 virginica 50 0.333