How to specify that the model should return class labels using errorest in R




I am trying to solve the hand written digit recognizer problem of Kaggle.I am trying to compare the error rates of various models as below:

As can be seen for the naiveBayes model there is an error.I understand that this is happening because nb returns posterior probabilities.I am sure there is a way to specify that I want predicted class instead of prob but how do I do it in the errorest function??
Can someone please help me with this??


@hackers - While predicting the class of the test data you can use** type** argument while predicting.

predict(object, newdata = newdata,type="class")

Hope this helps!