\Header{printcp}{Displays CP table for Fitted Rpart Object}
\keyword{tree}{printcp}
\begin{Description}\relax
Displays the \code{cp} table for fitted \code{rpart} object.
\end{Description}
\begin{Usage}
\begin{verbatim}
printcp(x, digits=getOption("digits") - 2)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] 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 of numbers to print.

\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Prints a table of optimal prunings based on a complexity parameter.
\end{Details}
\begin{SeeAlso}\relax
\code{\Link{summary.rpart}},  \code{\Link{rpart.object}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
data(car.test.frame)
z.auto <- rpart(Mileage ~ Weight, car.test.frame)
printcp(z.auto)
## Not run: 
Regression tree:
rpart(formula = Mileage ~ Weight, data = car.test.frame)

Variables actually used in tree construction:
[1] Weight

Root node error: 1354.6/60 = 22.576

        CP nsplit rel error  xerror     xstd 
1 0.595349      0   1.00000 1.03436 0.178526
2 0.134528      1   0.40465 0.60508 0.105217
3 0.012828      2   0.27012 0.45153 0.083330
4 0.010000      3   0.25729 0.44826 0.076998
## End(Not run)\end{ExampleCode}
\end{Examples}

