In R,
how do u retrieve for each node of a tree, the index of observations in each node in the tree, without recoding all the tree iterative procedure?
For example in rpart (an r package):
library(rpart)
fit <- rpart(Kyphosis ~ Age + Number + Start, data = kyphosis, cp = -1)
fit$splits
I would like to know for each splits, which observations go to the right node and which go to the left node.