Skip to content
Prev 42692 / 63421 Next

rpart package, text function, and round of class counts

On Sun, 4 Mar 2012, yindalon wrote:

            
You probably have a getOption("digits") of 4 or lower. text.rpart uses 
getOption("digits") - 3 as the default which then means only 1 significant 
digit and hence it rounds and uses scientific notation. Using

text(fit, use.n = TRUE, digits = 3)

should do the trick. Maybe adding setting xpd = TRUE in addition helps in 
avoiding clipping of some labels.

Also, I would recommend to use

library("partykit")
plot(as.party(fit))

for visualization which uses a display like for the ctree() function (also 
mentioned on the web page you quote below).