Skip to contents

Convert a list of steps to a recipe

Usage

steps_to_recipe(
  name,
  user,
  svy = survey_empty(type = "eaii", edition = "2019-2021"),
  description,
  steps,
  doi = NULL,
  topic = NULL
)

Arguments

name

A character string with the name of the recipe

user

A character string with the user of the recipe

svy

A Survey object

description

A character string with the description of the recipe

steps

A list with the steps of the recipe

doi

A character string with the DOI of the recipe

topic

A character string with the topic of the recipe

Value

A Recipe object

Examples

# \donttest{
dt <- data.table::data.table(
  id = 1:20, age = sample(18:65, 20, TRUE),
  w = runif(20, 0.5, 2)
)
svy <- Survey$new(
  data = dt, edition = "2023", type = "demo",
  psu = NULL, engine = "data.table",
  weight = add_weight(annual = "w")
)
svy <- step_compute(svy, age2 = age^2)
my_recipe <- steps_to_recipe(
  name = "age_vars", user = "analyst",
  svy = svy, description = "Age-derived variables",
  steps = get_steps(svy)
)
my_recipe
#> 
#> ── Recipe: age_vars ──
#> Author:  analyst
#> Survey:  demo / 2023
#> Version: 1.0.0
#> Description: Age-derived variables
#> Certification: community
#> 
#> ── Requires (1 variables) ──
#>   age
#> 
#> ── Pipeline (1 steps) ──
#>   1. [compute] -> age2  "Compute step"
#> 
#> ── Produces (1 variables) ──
#>   age2 [numeric]
#> 
# }