R: Prunes an Rpart Classification or Regression Tree
clip.rpart
R Documentation
Prunes an Rpart Classification or Regression Tree
Description
Reduces a prediction tree produced by rpart to a
smaller tree by specifying either a cost-complexity parameter,
or a number of nodes to which to prune.
Usage
clip.rpart (tree, cp=NULL, best=NULL)
Arguments
tree
object of class rpart.
cp
cost-complexity parameter.
best
number of nodes to which to prune.
If both cp and best are not NULL, then
cp is used.
Details
A minor enhancement of the existing prune.rpart to
incorporate the parameter best as it is used in the
(now defunct) prune.tree function in the old tree
package. See example.