Framework for R

Saving Work

save_model()

Save a model to the outputs directory

Saves a fitted model object to the configured models directory. The directory is created lazily on first use.

Usage

save_model(model, name, public = FALSE, overwrite = TRUE, ...)

Arguments

Name Description
model

A fitted model object (lm, glm, tidymodels workflow, etc.)

name

The name for the output file (without extension)

public

If TRUE, saves to public outputs directory (for project_sensitive type)

overwrite

If TRUE, overwrites existing files (default: TRUE)

...

Additional arguments passed to saveRDS()

Value

The path to the saved file (invisibly)

Examples

if (FALSE) {
# Fit and save a model
model <- lm(mpg ~ hp + wt, data = mtcars)
save_model(model, "mpg_regression")
}