[R] predict.rpart help
Terry Therneau
therneau at mayo.edu
Thu Mar 24 16:00:32 CET 2011
Make your own copy of predict.rpart:
mypredict <- rpart:::predict.rpart
(Even better to grab the source code version, then you can start with a
copy that has comments in it!)
Edit it to add type='where': about 1/3 of the way down you will see that
the routine has computed a variable "where"; that is what you want to
return.
Terry T.
---------- begin included message ----------
Is there a way to get predict.rpart() to return the nodes reached by the
new examples in addition to the predicted probabilities it already
returns? In other words, I would like to know the leaf node in the tree
object that each new example data drops down to.
Thanks in advance for your help.
More information about the R-help
mailing list