r caret predict returns fewer output than input
I downloaded your data and found what explains the discrepancy.
If you simply remove the missing values from your dataset, the length of the outputs match:
testRpart <- predict(fitRpart, newdata = na.omit(dtest))
Note nrow(na.omit(dtest))
is 1103, and length(testRpart)
is 1103. So you need a strategy to address missing values. See ?predict.rpart
and the options for the na.action parameter to choose what you want.