Create Split Labels For an Rpart Object
labels.rpart.RdThis function provides labels for the branches of an
rpart tree.
Usage
# S3 method for class 'rpart'
labels(object, digits=4, minlength=1, pretty, collapse=TRUE, ...)Arguments
- object
fitted model object of class
rpart. This is assumed to be the result of some function that produces an object with the same named components as that returned by therpartfunction.- digits
the number of digits to be used for numeric values. All of the
rpartfunctions that call labels explicitly set this value, withoptions("digits")as the default.- minlength
the minimum length for abbreviation of character or factor variables. If 0 no abbreviation is done; if 1 then single letters are used with
"a"for the first level,"b"for the second and so on. If the value is greater than 1, theabbreviatefunction is used.- pretty
an argument included for backwards compatibility:
pretty=0impliesminlength=0,pretty=NULLimpliesminlength=1, andpretty=TRUEimpliesminlength=4.- collapse
logical. The returned set of labels is always of the same length as the number of nodes in the tree. If
collapse=TRUE(default), the returned value is a vector of labels for the branch leading into each node, with"root"as the label for the top node. IfFALSE, the returned value is a two column matrix of labels for the left and right branches leading out from each node, with"leaf"as the branch labels for terminal nodes.- ...
optional arguments to
abbreviate.
Value
Vector of split labels (collapse=TRUE) or matrix
of left and right splits
(collapse=FALSE) for the supplied
rpart object. This function is called
by printing methods for rpart and is not
intended to be called
directly by the users.