save_model: Save a model to the outputs directory

View source: R/outputs.R

save_modelR Documentation

Save a model to the outputs directory

Description

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

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")
}



framework documentation built on Feb. 18, 2026, 1:07 a.m.