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
Might be there are missing values in the testdata, Add the following line before "predictionsTree <- predict(treeFit, testdata)" to remove NAs. I had the same error and now it works for me.
testdata <- testdata[complete.cases(testdata),]