Skip to contents

Make a list with all categorical values and

Usage

list_cats(df, ..., abc = TRUE)

Arguments

df

data.frame

...

Variables to segment counters

abc

Boolean. Sort alphabetically?

Value

List. Length same as number of categorical columns, each with a frequency data.frame using freqs().

Examples

data(dft) # Titanic dataset
df <- dft[, 1:5]
head(df)
#>   PassengerId Survived Pclass    Sex Age
#> 1           1    FALSE      3   male  22
#> 2           2     TRUE      1 female  38
#> 3           3     TRUE      3 female  26
#> 4           4     TRUE      1 female  35
#> 5           5    FALSE      3   male  35
#> 6           6    FALSE      3   male  NA
list_cats(df)
#> $Pclass
#> # A tibble: 3 × 3
#>   Pclass     n     p
#>   <chr>  <int> <dbl>
#> 1 1        216  24.2
#> 2 2        184  20.6
#> 3 3        491  55.1
#> 
#> $Sex
#> # A tibble: 2 × 3
#>   Sex        n     p
#>   <chr>  <int> <dbl>
#> 1 female   314  35.2
#> 2 male     577  64.8
#>