Hello,

I am trying to predict the classes of  a test data set after training an 
rpart tree.
When I run:
predict(rpart_object_based_on_training_data, newdata = "testdata", type 
= "class", na.action = na.pass)
I get an error message saying that a variable that is present in both 
training and test data sets has new
levels in the test set. This is true that there are new levels for some 
of the variables in the test set, although,
the variables themselves are identical in both. My understanding from 
reading the documentation on
predict.rpart is that if one of the facor-variables does have new levels 
in the test set, it is passed through the tree and
is left at the deepest possible node. I tried to run predict.rpart 
directly but it says "function not found". Does this have
to be installed separately? I have loaded the rpart library to run the 
training data. I have not
found this exact situation in the Archives.

Thankyou
Kamakshi

--
[EMAIL PROTECTED]

______________________________________________
[email protected] 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.

Reply via email to