I\'ve trained a tree model with R caret. I\'m now trying to generate a confusion matrix and keep getting the following error:
Error in confusionMatrix
If your data contains NAs then sometimes it will be considered as a factor level,So omit these NAs initially
DF = na.omit(DF)
Then,if your model fit is predicting some incorrect level,then it is better to use tables
confusionMatrix(table(Arg1, Arg2))