Suppose I have a decision tree from rpart
, How can I get all the data points in one node without writing all the conditions?
For example, How can I get 17 data points in Node 3, without writing if else on all splits?
library(rpart)
library(partykit)
fit=rpart(factor(am)~.,mtcars,control=rpart.control(minsplit = 2),cp=0)
plot(as.party(fit))