powered by
A label vector is converted to a dummy matrix.
dummyMatrix(y, center=TRUE)
A matrix is generated. The number of row is equal to the length of y and the number of columns is the number of unique elements of y.
A label vector to specify the group of data.
An option to center the rows of matrix (Default: TRUE).
Koki Tsuyuzaki
y <- c(1, 3, 2, 1, 4, 2) dummyMatrix(y)
Run the code above in your browser using DataLab