Skip to contents

Return the percentage each value or combination of values appear in a tibble or dataframe

Usage

percent(data, ..., .keep_n = FALSE)

Arguments

data

a tibble or dataframe

...

parameters to pass to dplyr::count()

.keep_n

logical; keep or remove the n col created by dplyr::count(). Defaults to FALSE.

Examples

# return a tibble of the percentage of gear type in the `mtcars` dataset
percent(mtcars, gear)
#>   gear     pct
#> 1    3 0.46875
#> 2    4 0.37500
#> 3    5 0.15625