Confusion matrix for PLSDA in R: “Error: `data` and `reference` should be factors with the same levels.”
I am trying to run a Partial Least Squares Discriminant Analysis (PLSDA) in R, followed by a prediction and confusion matrix, using the mdatools package. The mdatools::plsda function works normally, as does stats::predict, but I have been experiencing difficulties with caret::confusionMatrix.