Skip to contents

Recipe files are treated as untrusted input. The complete document is decoded and validated before supported constructors are applied. Importing bake configurations into an unprepared recipe never runs analysis unless prepare = TRUE is supplied explicitly.

Usage

import_steps(
  rec,
  file,
  prepare = FALSE,
  parallel = TRUE,
  workers = future::availableCores(constraints = "connections-16")
)

Arguments

rec

A Recipe() or PrepRecipe() object.

file

Input JSON path.

prepare

Whether an unprepared recipe may run prep() when the file contains bake configurations. Defaults to FALSE.

parallel

Passed to prep() only when prepare = TRUE.

workers

Passed to prep() only when prepare = TRUE.

Value

The configured Recipe or PrepRecipe.

Examples

data(metaHIV_phy)
configured <- recipe(metaHIV_phy) |>
  add_model(~ RiskGroup2, targets = "RiskGroup2", tax_level = "Species") |>
  step_filter_by_prevalence(threshold = 0.1)
path <- tempfile(fileext = ".json")
export_steps(configured, path)
restored <- import_steps(recipe(metaHIV_phy), path)