get_yieldamount: get_yieldamount

View source: R/endpoints.R

get_yieldamountR Documentation

get_yieldamount

Description

Makes a query to the Canadian Nutrient File yieldamount endpoint. This endpoint returns data from a list of food codes and corresponding yield amounts (yield from refuse and or cooking losses). For instance, if you search the food id 1002 (Beef Gravy), it will tell you that it takes 5.55 g dehydrated to make 60 mL and 9.26g to make 100 mL.

Usage

get_yieldamount(apiKey = NULL, foodCode = NULL, lang = "en")

Arguments

apiKey

Key to access the API. Can be retrieved from https://hc-sc.api.canada.ca/en/detail?api=cnf#!/Nutrient/get_nutrientamount. If none is provided, the system environment variables will be checked.

foodCode

The code indicating the food you want to search for. If null, all foods and their corresponding yields are returned.

lang

The language to return results in, can be either 'en' or 'fr'.

Value

A tibble containing food names and food codes, yield amounts, and yield names.

Examples

## Not run: 
get_yieldamount()
get_yieldamount(foodCode = 57)
get_yieldamount(foodCode = 57, lang = "fr")
## End(Not run)

nutrientr documentation built on March 18, 2022, 6:27 p.m.