I fitted a random forest model:
rf <- randomForest(as.factor(class) ~ B2 + B3 + B4, data=training,
importance=TRUE,
ntree=2000, na.action = na.omit)
I am then trying to predict using the testing dataset:
rf.predT <- predict(rf, testing)
But I am getting this error:
rf.predT <- predict(rf, testing)
Error in eval(predvars, data, env) : object 'B2' not found
But names(training) shows that it does contain 'B2'
names(training)
[1] "B1" "B2" "B3" "B4" "B5" "B6" "class"
Any solutions?