compute frequency table.

freq_table(data, ..., vars = NULL, na.rm = TRUE)

Arguments

data

a data frame

...

One or more unquoted expressions (or variable names) separated by commas. Used to specify variables of interest.

vars

optional character vector containing variable names.

na.rm

logical value. If TRUE (default), remove missing values in the variables used to create the frequency table.

Value

a data frame

Examples

data("ToothGrowth")
ToothGrowth %>% freq_table(supp, dose)
#> # A tibble: 6 × 4
#>   supp   dose     n  prop
#>   <fct> <dbl> <int> <dbl>
#> 1 OJ      0.5    10  33.3
#> 2 OJ      1      10  33.3
#> 3 OJ      2      10  33.3
#> 4 VC      0.5    10  33.3
#> 5 VC      1      10  33.3
#> 6 VC      2      10  33.3