findFoodName: Find food names based on keywords

View source: R/Search_functions.R

findFoodNameR Documentation

Find food names based on keywords

Description

This function allows finding food names based on query keywords.

Usage

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

## 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")

AndreaRMICL/NutrienTrackeR documentation built on July 5, 2023, 10:56 p.m.