powered by
Create an indicator matrix of dimension length(x) x (nlevels(x)-1) with the column corresponding to the baseline level removed (by default the first level is used as baseline).
factor2ind(x, baseline)
a matrix
a variable.
a string indicating the reference level.
x = gl(4, 2, labels = c( "A", "B", "C", "D")) factor2ind(x) factor2ind(x, "C")
Run the code above in your browser using DataLab