factors_to_indicators: Convert factors to indicator variables.

View source: R/factors_to_indicators.R

factors_to_indicatorsR Documentation

Convert factors to indicator variables.

Description

Turns factors into indicator variables with reasonable names.

Supports parallelization using future plans.

Based on code by Taylor Terry from 2013.

Usage

factors_to_indicators(
  data,
  predictors = colnames(data),
  max_levels = 200L,
  verbose = FALSE,
  data.table = FALSE
)

Arguments

data

.

predictors

.

max_levels

If a factor contains more than this many levels, issue a warning and don't convert it to indicators.

verbose

TBD

data.table

If TRUE, return a data.table (possibly faster).


ck37/ckTools documentation built on April 29, 2023, 11:47 p.m.