View source: R/get_modeldata.R
| get_modeldata | R Documentation |
get_modeldata() retrieves the data used to fit a model. If the data was
previously attached via set_modeldata(), it is returned directly. Otherwise,
the data is retrieved from the model object or the environment using
insight::get_data().
get_modeldata(model, ...)
set_modeldata(model, newdata)
model |
Model object |
... |
Additional arguments are passed to the |
newdata |
A data frame to attach to the model object. |
set_modeldata() attaches a dataset to a model object as an attribute. This
is useful when the training data may not be available in the environment where
marginaleffects functions are called, such as inside lapply(), in Shiny
apps, or in nested function calls. By attaching the data explicitly, you ensure
that marginaleffects always uses the correct dataset.
get_modeldata() returns a data frame of the original data used to
fit the model, or NULL if not available. set_modeldata() returns the
model with the data attached as an attribute.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.