Returns a single tidyFit object from a tidyfit.models frame based on a given row number.
get_tidyFit(df, ..., .first_row = TRUE)
a tidyfit.models frame created using m(), regress(), classify() and similar methods
arguments passed to dplyr::filter
to filter row in 'df' for which the model should be returned. filters can also include columns nested in df$settings
.
should the first row be returned if the (filtered) df contains multiple rows
An object of the class associated with the underlying fitting algorithm
This method is a utility to return the tidyFit object from a row index of the tidyfit.models frame. The tidyFit object contains the fitted model and several additional objects necessary to reproduce the analysis or refit the model on new data.
get_model
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
get_tidyFit(fit, am == 0)
#> <tidyFit> object
#> method: lm | mode: regression | fitted: yes
#> no errors ✔ | no warnings ✔
# get model by row number
get_tidyFit(fit, dplyr::row_number() == 2)
#> <tidyFit> object
#> method: lm | mode: regression | fitted: yes
#> no errors ✔ | no warnings ✔