Dear All,
I am a bit puzzled.
I am developing a random forest model.
The data is large and it involves hundred of predictors, but the code I have written is relatively simple. After training my random forest model, I apply it on some new data set to carry out some prediction, as you can see below


response_validation <- predict(rf,newdata=mydata,
                               type="response")

but I get this error message

Error in predict.randomForest(rf, newdata = mydata, type = "response") :
  variables in the training data missing in newdata

I am confused because I checked that there is no missing data neither in my training nor in my test data sets and the data types of the columns of both the test and train data sets are perfectly identical. Bottom line: I have no idea about how to debug this (it is almost as if the error message should not exist).
Any suggestion is welcome.
Cheers

Lorenzo

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to