Reputation: 2806
Trying to use R caret
to train a model using lm
linear regression:
Code is as per below:
modelLm <- train(x=X_train,y=Y_train, method="lm", na.action = na.omit, trControl=control)
But get the error:
Error in quantile.default(y, probs = seq(0, 1, length = cuts)) :
missing values and NaN's not allowed if 'na.rm' is FALSE
Isn't na.action = na.omit
supposed to ignore the missing values?
Upvotes: 0
Views: 1192
Reputation: 14316
When you don't use a formula, the train
calls train.default
and na.action
is not one of its arguments. na.action
is nicely baked into the formula machinery so either use that interface or use complete.cases
to get rid of them for train.default
.
Max
Upvotes: 1