Skip to content
Prev 79050 / 398502 Next

Predicting classification error from rpart

Anthony. Look at ?predict.rpart, I think this might be the kind of table you
are looking for.

     data(iris)
     sub <- c(sample(1:50, 25), sample(51:100, 25), sample(101:150, 25))
     fit <- rpart(Species ~ ., data=iris, subset=sub)
     fit
     table(predict(fit, iris[-sub,], type="class"), iris[-sub, "Species"])

HTH, Andy
http://www.R-project.org/posting-guide.html