Hello
I was able to get variable importance using iris data in R, using below code
tree=rpart(setosa_dummy~.,data=data,method="class")
tree$variable.importance
But when I tried the same with other data I have. tree$variable.importance returns NULL. Any specific reason for that. I was getting NaN for variable importance using "rf" method in caret. varImp() was used.