Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

addCatVars

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

Implementation of the 'PROCESS' Macro

v0.2.6
GPL-2
Authors
Keon-Woong Moon [aut, cre], Sokyoung Hong [ctb]
Initial release
2021-1-5

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.