Skip to content
Framework

Saving Work

load_model()

Load a model saved with save_model()

Reads <name>.rds from the models folder with readRDS(). framework-py saves models as <name>.pkl, which R cannot read.

Usage

load_model(name, public = NULL)

Arguments

Name Default Description
name

The name it was saved under, without extension.

public NULL

Which models folder to read in a project with private and public output folders: the public one (TRUE) or the private one (FALSE). Default (NULL): the private folder, then the public one. In other projects both are the one models folder.

Value

The model.

Details

A file that no longer matches the hash save_model() recorded in framework.db loads with a warning.

Examples

Not run

if (FALSE) {
model <- lm(mpg ~ hp + wt, data = mtcars, model = FALSE)
save_model(model, "mpg_regression")
model <- load_model("mpg_regression")
}

Related reference

Search guides and reference for R, Python, Stata, the CLI, and Framework Cloud.