I understand that when you generate a linear model, you can pull the residuals from the fit like this:
# Model
model <- lm(y ~ x, data = coolstuff)
# Residuals
myresids <- model$residuals
I understand further that you can use this model to predict values based on a second data set (e.g., a validation data set) like this:
mypreds <- predict(model, newdata = coolvalid)
Where I'm lost is where I can find the residuals from the prediction. predict doesn't generate a data frame or a tibble - just a named list of numbers.
Where can I find the residuals from the predictions?