get_model | R Documentation |
Returns a single fitted model object produced by the underlying fitting algorithm from a tidyfit.models frame based on a given row number.
get_model(df, ..., .first_row = TRUE)
df |
a tidyfit.models frame created using m(), regress(), classify() and similar methods |
... |
arguments passed to |
.first_row |
should the first row be returned if the (filtered) df contains multiple rows |
This method is a utility to return the object fitted by the underlying algorithm. For instance, when m("lm")
is used to create the tidyfit.models frame, the returned object is of class "lm".
An object of the class associated with the underlying fitting algorithm
Johann Pfitzinger
get_tidyFit
method
# Load data
data("mtcars")
# fit separate models for transmission types
mtcars <- dplyr::group_by(mtcars, am)
fit <- regress(mtcars, mpg ~ ., m("lm"))
# get the model for single row
summary(get_model(fit, am == 0))
# get model by row number
summary(get_model(fit, dplyr::row_number() == 2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.