I have two models to select from and using some criteria I choose one of the two. (The below is just an example, I know it doesn't make much sense)

```
library(forecast)
set.seed(4)
sample_dat= sample(1:nrow(cars), 5)
train = cars[-sample_dat, ]
test = cars[sample_dat, ]
models = list(lm(dist ~ speed, train), glm(dist ~ speed, train, family = "poisson"))
test_res = sapply(models, function(x) accuracy(predict(x, test, type = "response"), test$dist)[2]) #Getting the RMSE for each model
best_model = models[which.min(test_res)]

```

How can I retrain the best model using the full dataset (train + test)? I checked the `update` and `update.formula` functions but these don't seem to be updating the data part.