Learn R Programming

tablet (version 0.6.8)

categoricals.data.frame: Identify Categoricals for Data Frame

Description

Identifies categorical columns: literally, factors. Stacks factor levels and supplies value = 1.

Usage

# S3 method for data.frame
categoricals(x, ..., na.rm_fac = FALSE, exclude_fac = NULL, all_levels = FALSE)

Value

same class as x

Arguments

x

data.frame; names must not start with '_tablet_'

...

passed to classifiers

na.rm_fac

whether to drop NA observations; passed to gather as na.rm

exclude_fac

which factor levels to exclude; see factor (exclude)

all_levels

whether to supply records for unobserved levels

Examples

Run this code
example(classifiers)
categoricals(x)
levels(categoricals(x)$`_tablet_level`)

Run the code above in your browser using DataLab