\HeaderA{labels.rpart}{Create Split Labels For an Rpart Object}{labels.rpart}
\keyword{tree}{labels.rpart}
\begin{Description}\relax
This function provides labels for the branches of an
\code{rpart} tree.
\end{Description}
\begin{Usage}
\begin{verbatim}
## S3 method for class 'rpart':
labels(object, digits=4, minlength=1, pretty, collapse=TRUE, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{object}] fitted model object of class \code{rpart}.  This is 
assumed to be the result 
of some function that produces an object with the same named 
components as that returned by the \code{rpart} function.

\item[\code{digits}] the number of digits to be used for numeric values.  
All of the \code{rpart} functions that call labels
explicitly set this value, with \code{options("digits")}
as the default.

\item[\code{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
\code{"a"} for the first level, \code{"b"} for the second and so on.
If the value is greater than 1, the 
\code{abbreviate} function is used.

\item[\code{pretty}] an argument included for backwards compatibility:
\code{pretty=0} implies \code{minlength=0},
\code{pretty=NULL} implies \code{minlength=1}, and
\code{pretty=TRUE} implies \code{minlength=4}.

\item[\code{collapse}] logical.
The returned set of labels is always of the same length as the number
of nodes in the tree.  
If \code{collapse=TRUE} (default), 
the returned value is a vector of labels for the branch leading into
each node, with \code{"root"} as the label for the top node.
If \code{FALSE}, the returned value is a two
column matrix of labels for the left and right branches leading 
out from each node, with \code{"leaf"} as the branch labels for terminal
nodes.

\item[\code{...}] optional arguments to \code{abbreviate}.

\end{ldescription}
\end{Arguments}
\begin{Value}
Vector of split labels (\code{collapse=TRUE}) or matrix 
of left and right splits 
(\code{collapse=FALSE}) for the supplied 
\code{rpart} object.  This function is called 
by printing methods for \code{rpart} and is not 
intended to be called 
directly by the users.
\end{Value}
\begin{SeeAlso}\relax
\code{\LinkA{abbreviate}{abbreviate}}
\end{SeeAlso}

