[R] Re: printing tree results

White.Denis@epamail.epa.gov White.Denis at epamail.epa.gov
Thu Apr 18 18:01:33 CEST 2002


Look at help(sink).  I have figured out how to fix up draw.tree to do
factor labels correctly and will be doing that in the next few days.
Meanwhile I discovered that rpart() provides factor labels in a much
more satisfactory way than tree() does.  Because of this and because of
the additional information rpart provides about the tree building, I
recommend you switch to that.

> I have created a tree and want to save some of the
> data so that I can create a html table from it.
> I would like to save the output from data.ltr (see
> example below) to a file, but haven't found a way to
> do that, keeping the nice format that typing data.ltr
> gives me (see output below). Is there a way to do
> this?
>
> Example:
> library (maptree)
> library (tree)
> data<-read.csv("C:\\data.txt")
> cnames<-colnames(data)
> data$Vendor=as.factor(data$Vendor)
> data$Yield=as.numeric(data$Yield)
> data.ltr <- tree(Yield ~ ., data)
>
> Output:
> > data.ltr
> node), split, n, deviance, yval
>       * denotes terminal node
>
> 1) root 22 18.590 1.1360
>   2) X0100.WAFER.START.SCRIBE.PROD:
> 1TAGG3,1TAHK2,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA,NA
> 17  3.059 0.7647
>     4) e.F: 0,2,5 6  1.333 0.3333 *
>     5) e.F: 1,3,4 11  0.000 1.0000 *
>   3) X0100.WAFER.START.SCRIBE.PROD: 1TAHL7,NA,NA,NA 5
> 5.200 2.4000 *
> >

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list