inspect_cat {inspectdf}R Documentation

Summary and comparison of the levels in categorical columns

Description

For a single dataframe, summarise the levels of each categorical column. If two dataframes are supplied, compare the levels of categorical features that appear in both dataframes. For grouped dataframes, summarise the levels of categorical features separately for each group.

Usage

inspect_cat(df1, df2 = NULL, include_int = FALSE)

Arguments

df1

A dataframe.

df2

An optional second data frame for comparing categorical levels. Defaults to NULL.

include_int

Logical flag - whether to treat integer columns as categories. Default is FALSE.

Details

For a single dataframe, the tibble returned contains the columns:

For a pair of dataframes, the tibble returned contains the columns:

For a grouped dataframe, the tibble returned is as for a single dataframe, but where the first k columns are the grouping columns. There will be as many rows in the result as there are unique combinations of the grouping variables.

Value

A tibble summarising or comparing the categorical features in one or a pair of dataframes.

Author(s)

Alastair Rushworth

See Also

inspect_imb, show_plot

Examples

# Load dplyr for starwars data & pipe
library(dplyr)

# Single dataframe summary
inspect_cat(starwars)

# Paired dataframe comparison
inspect_cat(starwars, starwars[1:20, ])

# Grouped dataframe summary
starwars %>% group_by(gender) %>% inspect_cat()

[Package inspectdf version 0.0.12 Index]