mad: Make binary dummy variables out of a factor vector
Description
Make binary dummy variables out of a factor vector
Usage
mad(x, red = TRUE)
Arguments
x
A factor vector. Or a vector that is convertible to a factor.
red
Logical. Shall redundancy be retained? When a factor variable is broken down to binary dummy variables it is typically not wanted to transfer all levels to 0/1 vectors but to skip the last level because the information is already contained in the sum of t
Value
Returns a data.frame with binary data (0/1) with as many (n) rows as x has levels (with red=TRUE) or with n-1 levels when red=FALSE.