Enter below an R command to create the confusion matrix for…