get_tidyFit {tidyfit}R Documentation

Get a tidyFit model from a tidyfit.models frame

Description

Returns a single tidyFit object from a tidyfit.models frame based on a given row number.

Usage

get_tidyFit(df, ..., .first_row = TRUE)

Arguments

df

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.

.first_row

should the first row be returned if the (filtered) df contains multiple rows

Details

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.

Value

An object of the class associated with the underlying fitting algorithm

Author(s)

Johann Pfitzinger

See Also

get_model method

Examples

# 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)

# get model by row number
get_tidyFit(fit, dplyr::row_number() == 2)


[Package tidyfit version 0.7.4 Index]