fitControl <- trainControl(
method = "cv",
number = 5,
savePredictions = 'final',
classProbs = F)
predictors<-c("Age", "Quantile","label1","label2")
outcomeName<-'Life_expt'
model_rf<-train(Life_expt ~ Age+Quantile+label1+label2,Train2[country==.BY],method='rf',trControl=fitControl,tuneLength=3)
Error in .prepareFastSubset(isub = isub, x = x, enclos = parent.frame(), : RHS of == is length 0 which is not 1 or nrow (559). For robustness, no recycling is allowed (other than of length 1 RHS). Consider %in% instead.
I am trying to scale it across each country. I would like to use stacking approach and models (rf,svmRadial,glm). How can I do it for each country without the error?
Thanks