[R] predict problem

Weiwei Shi helprhelp at gmail.com
Mon May 16 21:27:16 CEST 2005


Hi, there:
I have a question on predict() function.
I built a set of trees using rpart and when I do prediction, I got the
following error:
Error in model.frame.default(Terms, newdata, na.action = act, xlev = attr(object
,  :
        factor V19 has new level(s) 45
Execution halted

I think the problem is caused by a new level (which is not used in
building trees) for V19. I am wondering if there is an argument in
predict() which can help suppress this error by just ignoring this
special observation in validation sample. If not, I can do some
pre-treatment to remove the obs with new level out for the time being.

Thanks,
-- 
Weiwei Shi, Ph.D

"Did you always know?"
"No, I did not. But I believed..."
---Matrix III




More information about the R-help mailing list