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. ______________________________________________ R-help@r-project.org 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.