[R] rpart: how to assign observations to nodes in regression trees

Terry Therneau therneau at mayo.edu
Tue Dec 1 15:10:12 CET 2009


help('rpart.object') will give you information on the return value from
rpart.  I think you want the 'where' portion.
 
For new data help('predict.rpart') gives the predicted results.

	Terry T

----------------------------------
Hi,
I am building a regression tree (method=anova) by using rpart package
and as a final result I get the final leaves characterized by
different means and standard deviations for the dependent variable.
However, differently from the classification tree for categorical
variables I cannot find a way to assign each observation to a leaf,
i.e. I can find no frame whcih contains the observation id coupled to
the leaf id. I also cannot found where the leaves id are stored.
Is there someone which can help me?
Regards, Diego.




More information about the R-help mailing list