Skip to contents

If the recipe_file exists, it is loaded and the pattern is inserted into it. If the recipe_file does not exist, it is created.

Usage

kwr_add_pattern(
  pattern = NULL,
  recipe_file = NULL,
  recipe_type = NULL,
  dim_name = NULL,
  value = NULL
)

Arguments

pattern

A regular expression.

recipe_file

A YAML file, which the pattern should be saved in.

recipe_type

Recipe type. One of: 'remove', 'include', 'tag' or 'label'.

dim_name

Dimension name for recipe types 'tag' and 'label'.

value

Optional value for recipe types 'tag' and 'label'.

Value

Nothing.

Examples

recipe_file <- file.path(tempdir(), "my-recipes.yml")

# Pruning recipe:
kwr_add_pattern(
  pattern = "xyz",
  recipe_file = recipe_file,
  recipe_type = "remove"
)

# Label recipe:
kwr_add_pattern(
  pattern = "xyz",
  recipe_file = recipe_file,
  recipe_type = "label",
  dim_name = "my_label"
)

file.remove(recipe_file)
#> [1] TRUE