categoricals.data.frame: Identify Categoricals for Data Frame

View source: R/tablet.R

categoricals.data.frameR Documentation

Identify Categoricals for Data Frame

Description

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

Usage

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

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

Value

same class as x

Examples

example(classifiers)
categoricals(x)
levels(categoricals(x)$`_tablet_level`)

tablet documentation built on Sept. 16, 2023, 1:08 a.m.