dummyToFactor {CMO} | R Documentation |
Condenses a multiple choice matrix (rows=individuals,columns=possible answers) to a vector of column labels.
dummyToFactor(x)
x |
Input matrix (rows=individuals,columns=possible answers) in 0,1 format |
No choice, missing values and multiple choices per row result in NA.
A numeric vector with column number of choice foreach row of the input matrix.
Christian Montel
#create some 0,1 matrix mat <- matrix(c(0,1,0,0,1,0,0,0),nrow=2) dummyToFactor(mat)