[R] problem in labeling the nodes of tree drawn by rpart

kaida ning kaidaningr at gmail.com
Mon Dec 7 20:26:33 CET 2009


Hi all,

I used rpart to fit a model, where the covariates in the model are
categorical variables.
Then I plotted the tree (mytree) and used the command "text" to add labels
to the tree.

In the nodes of the tree, the values of the covariates are represented with
a, b or c.
Is there a way to show the real value(s) of the variable in the nodes
instead of a, b or c ?
I found that the command "labels(mytree,minlength=3)" can give me the
desired label, but I don't know how to add it to the tree.


Best,
Kaida
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tree.pdf
Type: application/pdf
Size: 32968 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20091207/b9abc3a6/attachment-0002.pdf>


More information about the R-help mailing list