Skip to contents

This function retrieves data transformation recipes from the metasurvey repository or API, based on specific criteria such as survey type, edition, and topic. It is the primary way to access predefined and community-validated recipes.

Usage

get_recipe(
  svy_type = NULL,
  svy_edition = NULL,
  topic = NULL,
  allowMultiple = TRUE
)

Arguments

svy_type

String specifying the survey type. Examples: "ech", "eaii", "eai", "eph"

svy_edition

String specifying the survey edition. Supported formats: "YYYY", "YYYYMM", "YYYY-YYYY"

topic

String specifying the recipe topic. Examples: "labor_market", "poverty", "income", "demographics"

allowMultiple

Logical indicating whether multiple recipes are allowed. If FALSE and multiple matches exist, returns the most recent one

Value

Recipe object or list of Recipe objects according to the specified criteria and the value of allowMultiple

Details

This function is essential for:

  • Accessing official recipes: Get validated and maintained recipes by specialized teams

  • Reproducibility: Ensure different users apply the same standard transformations

  • Automation: Integrate recipes into automatic pipelines

  • Collaboration: Share methodologies between teams and organizations

  • Versioning: Access different recipe versions according to edition

The function first searches in local repositories and then queries the API if necessary. Recipes are cached to improve performance.

Search criteria are combined with AND operator, so all specified criteria must match for a recipe to be returned.

See also

recipe to create custom recipes save_recipe to save recipes locally read_recipe to read recipes from file publish_recipe to publish recipes to the repository load_survey where recipes are used

Examples

if (FALSE) { # \dontrun{
# Get specific recipe for ECH 2023
ech_recipe <- get_recipe(
  svy_type = "ech",
  svy_edition = "2023"
)

# Recipe for specific topic
labor_recipe <- get_recipe(
  svy_type = "ech", 
  svy_edition = "2023",
  topic = "labor_market"
)

# Allow multiple recipes
available_recipes <- get_recipe(
  svy_type = "eaii",
  svy_edition = "2019-2021",
  allowMultiple = TRUE
)

# Use recipe in load_survey
ech_with_recipe <- load_survey(
  path = "ech_2023.dta",
  svy_type = "ech",
  svy_edition = "2023", 
  recipes = get_recipe("ech", "2023"),
  bake = TRUE
)

# For year ranges
panel_recipe <- get_recipe(
  svy_type = "ech_panel",
  svy_edition = "2020-2023"
)
} # }