Skip to content

Plotting rpart trees with long list of class members

4 messages · MarkBeauchene, Jean V Adams

#
I have a class with 732 members, so using rpart.plot is giving me a tiny plot
in the middle of the window.  Is there a good way to modify the plot, or
replace the long list with something like "group1"?

--
View this message in context: http://r.789695.n4.nabble.com/Plotting-rpart-trees-with-long-list-of-class-members-tp4635671.html
Sent from the R help mailing list archive at Nabble.com.
2 days later
#
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)


--
View this message in context: http://r.789695.n4.nabble.com/Plotting-rpart-trees-with-long-list-of-class-members-tp4635671p4635915.html
Sent from the R help mailing list archive at Nabble.com.