[R] sweave and post "rpart"

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Aug 21 12:22:52 CEST 2004


On Sat, 21 Aug 2004, Christian Schulz wrote:

> Hi,
>
> have anybody positive experience how
> it is possible get the post output from a
> rpart-object in a large sweave file or is only the
> less nicely plot function instead of post possible???
>
> \begin{figure}[htbp]
>   \begin{center}
> <<fig=true,eps=T>>=
> post(dtreeEB, title="Tree",digits=getOption("digits") - 0,use.n=TRUE)
> @
>     \caption{Tree1}
>   \end{center}
> \end{figure}
>
>
> (1) if the rpart object result contain only the root node, i get this

That's not a tree so an error is probably correct if not so unfriendly a
one.  Perhaps you would like to submit a patch to the *authors*, cc the
maintainer.

> error:
> Error:  chunk 21
> Error in if (is.leaf[lson]) left <- list(left = x[lson], right = x[lson],  :
> 	missing value where TRUE/FALSE needed
>
> (2) if the rpart object contains further nodes sweave finished fine, but
> the plot-part contains no tree and "corupted" the tex-document, so
> a tex2pdf isn't possible.

post.rpart() does not produce graphics output on the open device.
If you trouble to read its help page, you will see the solution in the
Details: section.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list