I am trying to create an ordinal regression tree in R using rpart
, with the predictors mostly being ordinal data, stored as factor
in R.
When I created the tree using rpart
, I get something like this:
where the values are the factor values (E.g. A170
has labels ranging from -5 to 10).
However, when I use caret
to train
the data using rpart
, when I extract the final model, the tree no longer has ordinal predictors. See below for a sample output tree
As you see above, it seems the ordinal variable A170
now has been converted into multiple dummy categorical value, i.e. A17010
in the second tree is a dummy for A170
of value 10
.
So, is it possible to retain ordinal variables instead of converting factor variables into multiple binary indicator variables when fitting trees with the caret
package?