Neeti, I'm pretty sure that the error is related to the confusionMAtrix call, which is in the caret package, not e1071.
The error message is pretty clear: you need to pas in two factor objects that have the same levels. You can check by running the commands: str(pred_true1) str(species_test) Also, caret can do the resampling for you instead of you writing the loop yourself. Max ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.