get_food: get_food

View source: R/endpoints.R

get_foodR Documentation

get_food

Description

Makes a query to the Canadian Nutrient File food endpoint. This endpoint returns data from a list of food codes and corresponding names.

Usage

get_food(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 are returned.

lang

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

Value

A tibble containing food names and food ids.

Examples

## Not run: 
get_food()
get_food(foodCode = 2314)
get_food(foodcode = 2314, lang = "fr")

## End(Not run)

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