I am performing a PLS-DA but there are a few predictors in my model are categorical (0/1). When I format them as integer or numeric, then things are fine, but if I format them as factor then the program produce the following error:
plsda.fert<-plsda(X,Y,ncomp = ccomp,scale = TRUE)
Error in Check.entry.pls(X, Y, ncomp, keepX, keepY, mode = mode, scale = scale, :
‘X’ and/or ‘Y’ must be a numeric matrix.
In this case, it is ok /meaningful to format the categorical predictor as numeric (i.e. 0 mean unfavorable while 1 mean favarable), but what happens when the categorical predictors with let’s say values 0, 1,2,3 just indicates 4 different groups. I would I handle this with mixOmics PLSDA.