I'm using rpart
pacakge of R
and I want to extract the top 3 splits for the leaf node instead of just the best. Is it possible to do this without changing the source code of rpart
?
You can access the splits like this:
fit <- rpart(Kyphosis ~ Age + Number + Start, data = kyphosis)
fit$splits