Last chance! 50% off unlimited learning
Sale ends in
This function is designed to extract the response variable from a fitted model object.
get_model_response(object)
The response variable extracted from the model. If it couldn't be extracted,
the function returns NULL
.
A fitted model from which the response variable should be extracted.
The default method attempts to create a model frame using model.frame()
.
Any error encountered during this process is caught and
results in a NULL
return value.
lm_model <- lm(mpg ~ wt + cyl, data = mtcars)
response <- get_model_response(lm_model)
print(response)
Run the code above in your browser using DataLab