I'm doing some modelling using package randomForest. The rfImpute function is very nice for handling missing values when fitting the model. However, is there a way to get predictions for new cases that have missing values?
The following is based on the example in ?rfImpute.
iris.na <- iris
set.seed(111)
## artificially drop some data values.
for (i in 1:4) iris.na[sample(150, sample(20)), i] <- NA
## impute the dropped values
set.seed(222)
iris.imputed <- rfImpute(Species ~ ., iris.na)
## fit the model
set.seed(333)
iris.rf <- randomForest(Species ~ ., iris.imputed)
# now try to predict for a case where a variable is missing
> predict(iris.rf, iris.na[148, , drop=FALSE])
[1] <NA>
Levels: setosa versicolor virginica