Function confusionMatrix should not take a model as its argument
In the course scripts the function confusionMatrix is used incorrectly. Its first argument may NOT be a model, but should be a factor. It does return a confusion matrix but this is totally incorrect. The fact that the function does not throw an error is bad programming from the caret package author...