colToDummies: Changes a column containing multiple values to a matrix of...

View source: R/modalities_functions.R

colToDummiesR Documentation

Changes a column containing multiple values to a matrix of columns containing the dummies corresponding to each value.

Description

Changes a column containing multiple values to a matrix of columns containing the dummies corresponding to each value.

Usage

colToDummies(col, nameCol, modalities = NULL, keepValue = FALSE)

Arguments

col

input column

nameCol

name that will be used as a prefix for dummies column name in the output matrix

modalities

if a vector is entered, dummies produced will only be the ones corresponding to the values in the "modalities" input column + another one containing all the other modalities.

keepValue

Logical. If TRUE, puts not "1"s in the dummies output columns but the real values in the "col" column (except if values are non-numeric)

Value

Matrix containing the dummy columns


icarus documentation built on May 31, 2023, 9:43 p.m.