I am using ctree function within party R package. I would like to idenfiy all predictors that are used within the tree in order to reduce the data.frame dimension used for furth
You can try using this:
getUsefulPredictors<-function(x){
flatTree<-unlist(x@tree)
pred<-unique(flatTree[grepl("*variableName",names(flatTree))])
return(pred)
}
It flattens the trees and looks for the elements having variableName in their name
Run on your model it returns:
getUsefulPredictors(myModel)
#[1] "Temp" "Wind"