model_values | R Documentation |
One-stop shopping to fit a model and return the model output on the training data.
model_values(data, tilde, family = c("linear", "prob", "counts"))
data |
A data frame containing the training data. When used with |
tilde |
A model specification in the form of a tilde expression |
family |
The type of model architecture: |
This is intended to be used ONLY WITHIN mutate()
A vector (not a data frame) of the model evaluated on the training data.
This is intended mainly for use within mutate()
, so that a general model can be used in
the place of simple reduction verbs like mean()
, median()
mtcars |> mutate(mpg_mod = model_values(mpg ~ hp + wt)) |> select(hp, wt, mpg_mod) |> head()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.