Alvarez Pedro
2005-Sep-15 16:59 UTC
[R] How to label a plot of a tree dendrogram with text
Dear R list, I have generated a object of class rpart in R 2.1.1 (using the wrapper function "mvpart" of the mvpart-package version 1.0-1). In order to label the plot of the tree dendrogram with text I used "text.rpart". In this function it is possible to set the argument "label" to determine which values will label the nodes. In the case of my tree-object I have the following possibilities to chose the label-argument:> prunedtree2$frame[1:1,]var n wt dev yval complexity ncompete nsurrogate yval2.1 yval2.2 yval2.3 yval2.4 1 EST 4258 4258 377874512 113.6452 0.2399082 4 1 230.56740 118.06599 78.31141 27.63598 In order to produce labels with variable "n" I entered:> plot(prunedtree2) > text.rpart(prunedtree2,label="n")Although I set label="n", it always produces labels with variable "dev". I tried also to set label="yval", label="yval2.1", ... without any success, everytime it produces labels with "dev". What am I doing wrong? Thanks, Pedro.