[R] rpart leaves

Prof Brian D Ripley ripley at stats.ox.ac.uk
Sun May 26 08:56:53 CEST 2002


On Sun, 26 May 2002, Ko-Kang Kevin Wang wrote:

> Is it possible to manually specify how many leaves I want for a tree
> fitted by rpart(), or tree()?

Up to a point.  You can prune a tree to any member of the cost-complexity
sequence, but there need not be one of the given size.  prune.tree
allows one to specify a target size, and as I recall it package maptree has
Prune.rpart which is similar for rpart.  Check their help pages for exactly
what they do if the target size is not in the cost-complexity sequence.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list