get_nutrientamount: get_nutrientamount

View source: R/endpoints.R

get_nutrientamountR Documentation

get_nutrientamount

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

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

## Not run: 
get_nutrientamount()
get_nutrientamount(foodCode = 4)
get_nutrientamount(foodCode = 4, lang = "fr")

## End(Not run)

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