Check out example codes for "confusion matrix caret package r". It will help you in understanding the concepts better.

Code Example 1

confusionMatrix(data = test_set$pred, reference = test_set$obs)

Learn ReactJs, React Native from akashmittal.com