DUMMY {easyCODA} | R Documentation |
Dummy variable (indicator) coding
Description
Convert categorical variable to dummy (0/1) coding
Usage
DUMMY(x, catnames=NA)
Arguments
x |
Variable (vector) of categorical data to be coded |
catnames |
Category names |
Details
The function DUMMY
takes a categorical variable and converts it to a set of dummy variables (zeros and ones), where the ones indicate the corresponding category. There are as many columns in the result as there are unique categories in the input vector.
Author(s)
Michael Greenacre
Examples
# Indicator (dummy) coding of sex in FishMorphology data set
data(fish)
sex <- fish[,1]
sex.Z <- DUMMY(sex, catnames=c("F","M"))
[Package easyCODA version 0.34.3 Index]