get_nutrientamount: get_nutrientamount

Description Usage Arguments Value Examples

View source: R/endpoints.R

Description

Makes a query to the Canadian Nutrient File nutrientamount endpoint. This endpoint returns a list of nutrient id's and details about their corresponding nutrient amounts, standard error of observation of nutrient amount and their names. For instance, for nutrient id 5, the name of the nutrient measured is caffeine and its nutrient value is 0.

Usage

1
get_nutrientamount(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 nutrient amount are returned.

lang

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

Value

A tibble containing the foodCode, nutrient_value, number_observation, nutrientNameId, nutrient_web_name, nutrient_source_id

Examples

1
2
3
4
5
6
## Not run: 
get_nutrientamount()
get_nutrientamount(foodCode = 4)
get_nutrientamount(foodCode = 4, lang = "fr")

## End(Not run)

jufil19/nutrientr documentation built on Feb. 22, 2022, 9:40 p.m.