Customize terminal node with ctree

64 views Asked by At

I computed a conditional recursive partitioning tree in R with that code:

library(partykit)

fit.all.cov <-ctree(as.factor(status) ~ Age.groups + Sex + Education + Migrant.background + Income + Living.situation, data = training_cov,control = ctree_control(maxdepth = 3))
plot(fit.all.cov, gp = gpar(fontsize = 6))

Here is the output:

enter image description here

I'd like to have in a rectangular box the written percentage of deaths in each terminal node with the population size of each terminal node (n=) in each rectangular box (so instead of barplots having the numerical values). Does anyone know how can I customize the plot() code to remove the barplot and obtain the numerical values?

Thank you !

0

There are 0 answers