Thanks. Very helpful. You can use the information from the splits in the first tree, to define a new grouping variable, which will simplify the plot: suvar <- sort(unique(test_set$list_var)) test_set$var_grp <- as.factor(testtree$csplit[match(test_set$list_var, suvar)]) testtree2 <- rpart ( list_val ~ var_grp, data = test_set ) rpart.plot(testtree2, type=3)
Not to other readers, you will need to load these packages, before running the code: library(rpart) library(rpart.plot) Jean MarkBeauchene <markbeauch...@hotmail.com> wrote on 07/09/2012 03:42:32 PM: > Here is some sample code. It generates a class (list_var) that is used in > rpart. list_val is the dependant variable. > > The plot shows all the values of the class, which is a mess and makes the > plot unuseable. I'd like to either suppress the list entirely or replace it > with something like "Group 1", "Group 2", etc. > > list_var <- rep(NA,2000) > list_val <- rep(NA,2000) > for (i in 1:1000) { > list_var[i] <- paste("A",i%/%25,sep='') > list_val[i] <- runif(1,0,1) } > test_set <- data.frame(list_var, list_val ) > > > > > testtree <- rpart ( list_val ~ list_var, data = test_set ) > rpart.plot(testtree, type=3) [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.