Recipe R6 class
Recipe R6 class
Details
R6 class representing a reproducible data transformation recipe for surveys. It encapsulates metadata, declared dependencies, and a list of transformation steps to be applied to a Survey object.
Methods
- $new(name, edition, survey_type, default_engine, depends_on, user, description, steps, id, doi, topic)
Class constructor.
- $doc()
Auto-generate documentation from recipe steps. Returns a list with metadata, input_variables, output_variables, and pipeline information.
- $validate(svy)
Validate that a survey object has all required input variables.
Public fields
nameDescriptive name of the recipe (character).
editionTarget edition/period (character or Date).
survey_typeSurvey type (character), e.g., "ech", "eaii".
default_engineDefault evaluation engine (character).
depends_onVector/list of dependencies declared by the steps.
userAuthor/owner (character).
descriptionRecipe description (character).
idUnique identifier (character/numeric).
stepsList of step calls that make up the workflow.
doiDOI or external identifier (character|NULL).
bakeLogical flag indicating whether it has been applied.
topicRecipe topic (character|NULL).
step_objectsList of Step R6 objects (list|NULL), used for documentation generation.
categoriesList of RecipeCategory objects for classification.
downloadsInteger download/usage count.
certificationRecipeCertification object (default community).
user_infoRecipeUser object or NULL.
versionRecipe version string.
depends_on_recipesList of recipe IDs that must be applied before this one.
data_sourceList with S3 bucket info (s3_bucket, s3_prefix, file_pattern, provider) or NULL.
labelsList with variable and value labels (var_labels, val_labels) or NULL.
Methods
Method new()
Create a Recipe object
Usage
Recipe$new(
name,
edition,
survey_type,
default_engine,
depends_on,
user,
description,
steps,
id,
doi = NULL,
topic = NULL,
step_objects = NULL,
cached_doc = NULL,
categories = list(),
downloads = 0L,
certification = NULL,
user_info = NULL,
version = "1.0.0",
depends_on_recipes = list(),
data_source = NULL,
labels = NULL
)Arguments
nameDescriptive name of the recipe (character)
editionTarget edition/period (character or Date)
survey_typeSurvey type (character), e.g., "ech", "eaii"
default_engineDefault evaluation engine (character)
depends_onVector or list of declared dependencies
userAuthor or owner of the recipe (character)
descriptionDetailed description of the recipe (character)
stepsList of step calls that make up the workflow
idUnique identifier (character or numeric)
doiDOI or external identifier (character or NULL)
topicRecipe topic (character or NULL)
step_objectsList of Step R6 objects (optional, used for doc generation)
cached_docPre-computed documentation (optional, used when loading from JSON)
categoriesList of RecipeCategory objects (optional)
downloadsInteger download count (default 0)
certificationRecipeCertification object (optional, default community)
user_infoRecipeUser object (optional)
versionRecipe version string (default "1.0.0")
depends_on_recipesList of recipe IDs that must be applied before this one (optional)
data_sourceList with S3 bucket info (optional)
labelsList with var_labels and val_labels (optional)
Method add_category()
Add a category to the recipe
Method remove_category()
Remove a category by name
Method to_list()
Serialize Recipe to a plain list suitable for JSON/API publishing. Steps are encoded as character strings via deparse().
Examples
# Use the recipe() constructor:
svy <- survey_empty(type = "ech", edition = "2023")
r <- recipe(
name = "Example", user = "Test", svy = svy,
description = "Example recipe"
)