# Finding the training- and test-error for a glm-model

I have a data-set with approx. 200 000 observations and 10 predictors, with continuous target. I have divided this data into a training set and a test set (70%/30%). I want to compare a glm-model against a random forest-model. I'm attempting to do so by comparing their performance on the test set.

I would like to calculate the training- and the test-errors for the glm-model. So far I've tried 10-fold cross-validation on the training set:

library(caret)
train.control<-trainControl(method='cv',number=10)
model<-(target~., data=train, method='glm',trControl=train.control)


then in the summary, it says RMSE=0.2915827, is this the training-error?

How do I get the test-error from this?

Predictions = predict(model, data=test)