View source: R/Search_functions.R
subsetFoodRichIn | R Documentation |
This function selects the foods with the highest amount of a given nutrient from a food composition database.
subsetFoodRichIn(nutrient_name, food_database = "USDA", food_group = NULL, n = 10)
nutrient_name |
character vector indicating the name of the nutrient of interest. |
food_database |
character vector indicating the food database to be used. Possible values are: "USDA", "CIQUAL", "BEDCA". |
food_group |
character vector indicating the food group(s) of interest. NULL indicates that all food groups are considered. |
n |
numeric value indicating the number of foods to be selected. |
A subset from the food composition database containing the foods with the highest amount of the nutrient of interest.
## Load data
data(food_composition_data)
## Get foods rich in niacin
subsetFoodRichIn(nutrient_name = "Niacin (mg)", food_database = "USDA", n = 5)
subsetFoodRichIn(nutrient_name = "Niacin (mg)", food_database = "CIQUAL", n = 5)
subsetFoodRichIn(nutrient_name = "Niacin (mg)", food_database = "BEDCA", n = 5)
## Get foods rich in niacin from CIQUAL within the group "diary products and deserts"
subsetFoodRichIn(nutrient_name = "Niacin (mg)", food_database = "CIQUAL", n = 5,
food_group = "dairy products and deserts")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.