Reputation: 11
I am trying to run generalized linear model on my balanced(using SMOTE) train dataset but when I run the below R code I get an error saying
"Error: $ operator is invalid for atomic vectors"
Don't really know what it means. Any help would be highly appreciated!
model.glm<- train(Accident_Severity ~ ., data= smote_train,
method = "glm",metric = RMSE, trControl= "ctrl")
Upvotes: 0
Views: 1367
Reputation: 181
You have misspecified the options for the train
function. This may work for you:
model.glm <- train(Accident_Severity ~ ., data = smote_train,
method = "glm", metric = "Kappa", trControl= trainControl())
In your original function call, the option trControl = "ctrl"
caused the error message that you got. However, it's also likely that the option metric = "RMSE"
will not work with your data (I am assuming that your variable Accident_Severity
is a factor variable and that you are trying to fit a classification model).
Upvotes: 1