r caret confusion matrix code example Example: confusion matrix caret package r confusionMatrix(data = test_set$pred, reference = test_set$obs)