About
Dummy codes in order to handle Categorical Variable
Articles Related
Function
C
- With a categorical predictor, dummy codes to represent the nominal variable as numeric using the function C (for contrasts)
myCategoricalPredictor <- C(data$CategoricalPredictor, treatment)
model <- lm(data$OutcomeVariable ~ data$NumericPredictorVariable + myCategoricalPredictor)
? This is not always needed as R will do it for you
Contrast
contrasts will give you the details of the dummy variable.
contrasts(myObject)
Red Blue
Green 0 0
Red 1 0
Blue 0 1