prune | R Documentation |
This function prunes a fitted dpart
object based on either the standard
error or number of splits required.
## S3 method for class 'dpart'
prune(tree, se, nsplits, ...)
## S3 method for class 'dpart'
prune(tree, se, nsplits, ...)
tree |
a legitimate tree object of class |
... |
arguments to be passed to or from other methods |
se |
numeric. A standard error used to prune. |
nsplits |
numeric. Number of splits to prune to. |
A new dpart
object that is pruned based on the number of standard errors
or number of splits.
Breiman, L., Friedman, J.H., Olshen, R.A. and Stone, C.J. (1984) Classification and Regression Trees. Wadsworth International.
dpart
# Load data
#data(yftdiet)
# Load the prey taxa data
#data(PreyTaxonSort)
# Assigning prey colours for default palette
#val <- apc(x = yftdiet, preyfile = PreyTaxonSort, check = TRUE)
#node.colsY <- val$cols
#dietPP <- val$x # updated diet matrix with Group assigned prey taxa codes
# Fitting the classification tree
#yft.dp <- dpart(Group ~ Lat + Lon + Year + Quarter + SST + Length,
# data = dietPP, weights = W, minsplit = 10,
# cp = 0.001)
#yft.pr <- prune(yft.dp, se = 1)
#plot(yft.pr, node.cols = node.colsY)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.