Skip to contents

Summary statistics for categoric variables.

Usage

summary_cat(x)

Arguments

x

A character vector

Value

A tibble with:


- n: the number of observations;
- na: the number of missing values;
- blank_space: the number of values blank ("");
- n_distinct: the number of distinct levels;
- mode: the mode.

Examples


x <- c(sample(letters,100,replace = TRUE),NA)

x
#>   [1] "l" "y" "n" "c" "n" "g" "c" "w" "v" "z" "o" "u" "e" "h" "s" "j" "r" "j"
#>  [19] "l" "b" "j" "v" "l" "t" "n" "q" "n" "v" "c" "h" "n" "s" "o" "x" "q" "w"
#>  [37] "k" "g" "o" "w" "z" "f" "n" "g" "j" "e" "f" "p" "x" "u" "w" "k" "d" "l"
#>  [55] "n" "s" "y" "g" "v" "z" "i" "g" "b" "p" "m" "s" "x" "t" "o" "g" "d" "a"
#>  [73] "h" "t" "y" "p" "x" "v" "k" "p" "t" "h" "c" "d" "t" "l" "v" "q" "j" "t"
#>  [91] "k" "y" "w" "h" "n" "u" "m" "b" "k" "m" NA 

summary_cat(x)
#> # A tibble: 1 × 6
#>       n    na blank_space n_distinct mode  modality
#>   <int> <int>       <int>      <int> <chr>    <int>
#> 1   101     1           0         26 n            1