rpart: how to remove the "long" labels

451 views Asked by At

I am wondering is there any way that I can remove the (long) labels in my tree. For example, in the following tree I would not to remove the label for the branch #6 i.e. Clarity =l1,Sl2,Sl1,VS2

library(rpart.plot)
library(rpart)
data(diamonds)

    fit <- rpart(price ~ carat + cut + clarity, diamonds, method = "anova")
    rpart.plot(fit, type = 2, nn=T, extra = 101) 

enter image description here

FYI, in reality in my data the label of one branch is ID and it goes from one side of the image to the other! That's why I want to find a way to only not show the label but the tree would stay!

Any help with explanation is highly appreciated.

0

There are 0 answers