get_nutrientname: get_nutrientname

Description Usage Arguments Value Examples

View source: R/endpoints.R

Description

Makes a query to the Canadian Nutrient File nutrientname endpoint. This endpoint returns a list of all nutrient names, symbols, names, unit of measurement, nutrient group name, etc. For instance, for nutrient name id of 810, the corresponding nutrient symbol is STAR and nutrient name is STARCH, unit is 2 and nutrient group id is 2.

Usage

1
get_nutrientname(apiKey = NULL, nutrientNameId = 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_nutrientname. If none is provided, the system environment variables will be checked.

nutrientNameId

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

lang

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

Value

A tibble containing nutrient name id, name, code, web_name and other details

Examples

1
2
3
4
5
## Not run: 
get_nutrientname()
get_nutrientname(nutrientNameId = 550)
get_nutrientname(nutrientNameId = 550, lang = "fr")
## End(Not run)

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