powered by
Flexible dummy-coding allowing for all R's built-in types of contrasts and optional dropping of a factor level to reduce rank defficiency probability.
dummycode(Y, contrast = "contr.sum", drop = TRUE)
matrix made by dummy-coding the input vector.
matrix
vector to dummy code.
vector
Contrast type, default = "contr.sum".
logical indicating if one level should be dropped (default = TRUE).
logical
vec <- c("a","a","b","b","c","c") dummycode(vec)
Run the code above in your browser using DataLab