Learn R Programming

nutrientr (version 0.1)

get_refuseamount: get_refuseamount

Description

Makes a query to the Canadian Nutrient File refuseamount endpoint. This endpoint returns a list of refuse amounts and name as well as the corresponding food code and description. Refuse amounts correspond to the inedible portion of the food. For instance, searching for food code 557 (Chicken, broiler, meat, skin, giblets and neck) will return a refuse amount of 28 and its associated name is 'bone'.

Usage

get_refuseamount(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 refuse amounts are returned.

lang

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

Value

A tibble containing refuse name, refuse amount, food names and food codes.

Examples

Run this code
# NOT RUN {
get_refuseamount()
get_refuseamount(foodCode = 557)
get_refuseamount(foodCode = 557, lang = "fr")
# }

Run the code above in your browser using DataLab