addCatVars: Add dummy vars to data.frame

View source: R/addCatVars.R

addCatVarsR Documentation

Add dummy vars to data.frame

Description

Add dummy vars to data.frame

Usage

addCatVars(df, varnames, groupLetter = "D", mode = 1)

Arguments

df

A data.frame

varnames

Variable name to be converted as factor and add dummies

groupLetter

A character

mode

Numeric. One of 1:4. 1= simple indicator coding, 2= sequential coding, 3= Helmert coding, 4= effect coding

Examples

mtcars1=addCatVars(mtcars,c("cyl","carb"))
mtcars1[c(3:5),]
mtcars2=addCatVars(mtcars,c("cyl","carb"),mode=3)
mtcars2[c(3:5),]
protest1=addCatVars(protest,"protest")
head(protest1)
iris1=addCatVars(iris,c("Species"),mode=3)
(iris1[c(1,51,101),])

processR documentation built on Jan. 23, 2023, 5:44 p.m.