categorical_summary: Create a summary table of a data.frame's categorical (factor)...

Description Usage Arguments Value Examples

Description

This will output a two-column table where the first is the name of the column and the second is the name of that column's levels.

Usage

1

Arguments

df

The data.frame to create a categorical summary from

Value

A tbl_df with two columns, variable and levels. The variable column contains the name of each categorical column, repeated for each level it had, in the same order as in df. The levels column contains each level for the associated variable.

Examples

1
2
3
4
5
6
df <- data.frame(
  id = 1:5,
  gender = factor(c("M", "F", "M", "M", "F")),
  race = factor(c("white", "white", "black", "black", "other"))
)
categorical_summary(df)

SSW-DataLab/sswdlHelpR documentation built on May 9, 2019, 11:43 a.m.