I trained a logistic regression model using caret's train() function with the method set to "glm". In the summary output of the model, a "1" has been added to all features that are factors. When I save the model with saveRDS() and load the model for prediction with readRDS(), I am unable to fit the model as I get the following error message: Error in eval(predvars, data, env) : object 'featurename1' not found The feature "featurename1" does not exist in my data because the original name is "featurename" without the "1".
If I predict on the test data in the same file, without saving the object then the prediction works perfectly fine. Only if I want to save the object and then use this object to predict on new data I get the mentioned error message.