While building a decision tree for a categorical variable in my dataset in R, I get an error when I try to plot my decision tree. The variable status_group is categorical and amount_tsh is numeric.
Error in apply(model$frame$yval2[, yval2per], 1, function(x) x[1 + x]) :
dim(X) must have a positive length
Why is this error coming and how to remove it?