S4 class containing names, amounts and units of recipe ingredients
Source:R/Ingredients-class.R
, R/Ingredients-methods.R
Ingredients-class.Rd
An Ingredients-class
object contains information regarding the name,
quantity and units for each ingredient. Although autorecipes
provides an
Ingredients()
constructor, it is unlikely that users will need to call this
to create Ingredient-class
instances directly. Instead, when creating a
RecipeBook-class
instance, helper functions are included to read
ingredients into the appropriate format such as the RecipeBook()
constructor and read_ingredients()
.
Usage
Ingredients(names, amounts = 1, units = rep(NA_character_, length(names)))
# S4 method for Ingredients
show(object)
# S4 method for Ingredients
names(x)
amounts(x)
units(x)
# S4 method for Ingredients
as.data.frame(x)
Arguments
- names
character()
containing the names of each ingredient.- amounts
numeric()
containing the amounts of each ingredient.- units
character()
containing the units for the amount of each ingredient.- object
an
Ingredients-class
object.- x
an
Ingredients-class
object.
Slots
names
character()
containing the names of each ingredient.amounts
numeric()
containing the amounts of each ingredient.units
character()
containing the units for the amount of each ingredient.