findFoodName: Find food names based on keywords

Description Usage Arguments Value Examples

View source: R/Search_functions.R

Description

This function allows finding food names based on query keywords.

Usage

1
findFoodName(keywords, food_database = "USDA", food_group = NULL, ignore_case = TRUE)

Arguments

keywords

character vector of containing one or several keywords. For example, "peppers, "green" and "raw" would be good keywords for the food: "Peppers, sweet, green, raw".

food_database

character vector indicating the food database to be used. Possible values are: "USDA", "CIQUAL", "BEDCA", "CNF".

food_group

character vector indicating the food groups that are likely to contain the food of interest. NULL indicates that the search is done using all food groups.

ignore_case

logical constant indicating whether the search is case sensitive.

Value

A vector of matched food names.

Examples

1
2
3
4
5
6
7
## Load data
data(food_composition_data)

findFoodName(keywords = c("Rice", "brown", "raw"), food_database = "USDA")
findFoodName(keywords = c("Rice", "brown", "raw"), food_database = "CIQUAL")
findFoodName(keywords = c("Rice", "brown", "raw"), food_database = "BEDCA")
findFoodName(keywords = c("rice", "brown"), food_database = "CNF")

NutrienTrackeR documentation built on Nov. 14, 2021, 5:07 p.m.