Skip to contents

Read in a list of ingredients from a character vector

Usage

read_ingredients(ingredients, delim = ";")

Arguments

ingredients

character() containing ingredient info separated by delim. Each element should denote the ingredients coming from a distinct recipe.

delim

character() that separates each ingredient.

Value

list() of elements of Ingredients-class objects.

Examples

read_ingredients(
  c(
    "butter;6 eggs;1 bag coriander;1 punnet mixed baby tomatoes",
    "1 tsp garam masala;1 bag baby spinach;1 lemon;1 chilli"
  ),
  delim = ";"
)
#> [[1]]
#> 1 Butter
#> 6 Eggs
#> 1 bag Coriander
#> 1 punnet Mixed Baby Tomatoes
#> 
#> [[2]]
#> 1 tsp Garam Masala
#> 1 bag Baby Spinach
#> 1 Lemon
#> 1 Chilli
#>