Learn R Programming

tablet (version 0.2.7)

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)

Arguments

x

data.frame; names must not include 'name' or 'level'

...

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)

Value

same class as x

Examples

Run this code
# NOT RUN {
example(classifiers)
categoricals(x)
levels(categoricals(x)$level)
# }

Run the code above in your browser using DataLab