Title: | Food Composition Information and Dietary Assessment |
---|---|
Description: | Provides a tool set for food information and dietary assessment. It uses food composition data from several reference databases, including: 'USDA' (United States), 'CIQUAL' (France), 'BEDCA' (Spain), 'CNF' (Canada) and 'STFCJ' (Japan). 'NutrienTrackeR' calculates the intake levels for both macronutrient and micronutrients, and compares them with the recommended dietary allowances (RDA). It includes a number of visualization tools, such as time series plots of nutrient intake, and pie-charts showing the main foods contributing to the intake level of a given nutrient. A shiny app exposing the main functionalities of the package is also provided. |
Authors: | Andrea Rodriguez-Martinez [aut], Rafael Ayala [aut, cre] , Mark Balchunas [aut], Daniel Gutiérrez-Del-Río [aut] , Ting-Hua Chen [aut] , Yacine Debbabi [aut], Lara Sellés Vidal [aut] |
Maintainer: | Rafael Ayala <[email protected]> |
License: | GPL-3 |
Version: | 1.3.0 |
Built: | 2025-01-05 05:03:42 UTC |
Source: | https://github.com/cran/NutrienTrackeR |
This function calculates the daily nutrient intake of an individual and compares it with the NIH nutrient recommendations (recommended dietary allowances (RDA) and tolerable upper intake levels (TUIL)).
dietBalance(my_daily_food, food_database = "USDA", age = 27, gender = "female", pregnant = FALSE, lactation = FALSE, summary_report = TRUE)
dietBalance(my_daily_food, food_database = "USDA", age = 27, gender = "female", pregnant = FALSE, lactation = FALSE, summary_report = TRUE)
my_daily_food |
matrix or a list of matrices, where each matrix reports all the foods eaten in a given day. The matrix must have two columns: 1)"food" (reporting food names) and 2) "units" (reporting the number of units relative to 100 grams, e.g. 125 g -> 1.25). For more details, see the dataset "sample_diet_USDA". |
food_database |
character vector indicating the food database to be used. Possible values are: "USDA", "CIQUAL", "BEDCA", "CNF", "STFCJ". |
age |
numeric vector indicating age. |
gender |
character vector indicating gender (i.e. "female" or "male"). |
pregnant |
logical constant indicating pregnancy status. |
lactation |
logical constant indicating lactation status. |
summary_report |
logical constant indicating whether a summary of results (e.g.nutrients whose daily intake level is below RDA or above TUIL) will be reported. |
A list, where the first element indicates daily nutrient intake; the second element indicates the contribution of each food to the total intake level of each nutrient (as percentage); and the second element reports the total intake level of each nutrient relative to the RDA (as percentage). When my_daily_food is a list, the results correspond to an average daily intake.
https://ndb.nal.usda.gov/ndb/
http://www.bedca.net/
https://ciqual.anses.fr/
## Load data data(food_composition_data) data(NIH_nutrient_recommendations) data(nutrient_group) data(sample_diet_USDA) ## contains an example of a one-week diet day1 = sample_diet_USDA[[1]] weekly_balanceF <- dietBalance(my_daily_food = sample_diet_USDA, food_database = "USDA", age = 27, gender = "female") day1_balanceF <- dietBalance(my_daily_food = day1, food_database = "USDA", age = 27, gender = "female") day1_balanceM <- dietBalance(my_daily_food = day1, food_database = "USDA", age = 27, gender = "male") day1_balanceF <- dietBalance(my_daily_food = day1, food_database = "USDA", age = 27, gender = "male")
## Load data data(food_composition_data) data(NIH_nutrient_recommendations) data(nutrient_group) data(sample_diet_USDA) ## contains an example of a one-week diet day1 = sample_diet_USDA[[1]] weekly_balanceF <- dietBalance(my_daily_food = sample_diet_USDA, food_database = "USDA", age = 27, gender = "female") day1_balanceF <- dietBalance(my_daily_food = day1, food_database = "USDA", age = 27, gender = "female") day1_balanceM <- dietBalance(my_daily_food = day1, food_database = "USDA", age = 27, gender = "male") day1_balanceF <- dietBalance(my_daily_food = day1, food_database = "USDA", age = 27, gender = "male")
This function allows finding food names based on query keywords.
findFoodName(keywords, food_database = "USDA", food_group = NULL, ignore_case = TRUE)
findFoodName(keywords, food_database = "USDA", food_group = NULL, ignore_case = TRUE)
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", "STFCJ". |
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. |
A vector of matched food names.
## 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")
## 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")
This list contains 3 different food composition tables, which provide information on the average nutritional value of foods consumed in United States (USDA standard reference database), France (CIQUAL database), Spain (BEDCA database), Canada (CNF database) and Japan (Standard Tables of Food Composition, STFCJ). All nutrition information is provided per 100 grams of food.
data(food_composition_data)
data(food_composition_data)
List
List
https://ndb.nal.usda.gov/ndb/
http://www.bedca.net/
https://ciqual.anses.fr/
https://www.canada.ca/en/health-canada/services/food-nutrition/healthy-eating/nutrient-data.html
This function returns the names of the different food groups included in a given database.
getFoodGroups(food_database = "USDA")
getFoodGroups(food_database = "USDA")
food_database |
character vector indicating the food database to be used. Possible values are: "USDA", "CIQUAL", "BEDCA", "CNF", "STFCJ". |
A vector of food groups.
## Load data data(food_composition_data) ## Get food groups from USDA getFoodGroups("USDA") ## Get food groups from CIQUAL getFoodGroups("CIQUAL") ## Get food groups from BEDCA getFoodGroups("BEDCA") ## Get food groups from CNF getFoodGroups("CNF")
## Load data data(food_composition_data) ## Get food groups from USDA getFoodGroups("USDA") ## Get food groups from CIQUAL getFoodGroups("CIQUAL") ## Get food groups from BEDCA getFoodGroups("BEDCA") ## Get food groups from CNF getFoodGroups("CNF")
This function returns the names of all nutrients included in a given database.
getNutrientNames(food_database = "USDA")
getNutrientNames(food_database = "USDA")
food_database |
character vector indicating the food database to be used. Possible values are: "USDA", "CIQUAL", "BEDCA", "CNF", "STFCJ". |
A vector of nutrient names.
## Load data data(food_composition_data) ## Get nutrient names from USDA getNutrientNames("USDA") ## Get nutrient names from CIQUAL getNutrientNames("CIQUAL") ## Get nutrient names from BEDCA getNutrientNames("BEDCA") ## Get nutrient names from CNF getNutrientNames("CNF")
## Load data data(food_composition_data) ## Get nutrient names from USDA getNutrientNames("USDA") ## Get nutrient names from CIQUAL getNutrientNames("CIQUAL") ## Get nutrient names from BEDCA getNutrientNames("BEDCA") ## Get nutrient names from CNF getNutrientNames("CNF")
This list contains nutrient recommendations from the NIH (National Institutes of Health) database:
- The first element of the list contains the recommended dietary allowance (RDA) of 33 nutrients, by gender and age.
- The second element of the list contains the tolerable upper intake level (TUIL) of 30 nutrients, by gender and age.
data(NIH_nutrient_recommendations)
data(NIH_nutrient_recommendations)
List
List
This matrix contains nutrient names and groups, for all nutrients included in the NIH_nutrient_recommendations dataset.
data(nutrient_group)
data(nutrient_group)
Matrix
List
https://www.nih.gov/
This function generates a barplot of nutrient intake levels, based on the output generated with the function dietBalance().
nutrientIntakePlot(daily_intake, color_scale = c("salmon", "cornflowerblue", "palegreen3"), macronutrientsOnly = FALSE)
nutrientIntakePlot(daily_intake, color_scale = c("salmon", "cornflowerblue", "palegreen3"), macronutrientsOnly = FALSE)
daily_intake |
list generated with the function dietBalance(). |
color_scale |
character vector indicating the colors used to fill the bars, according to nutrient groups: macronutrient (first color), mineral (second color), vitamin (third color). |
macronutrientsOnly |
logical indicating if only macronutrients should be
plotted. In the default behaviour, |
A barplot of nutrient intake levels, expressed as a percentage of RDA.
## Load data data(food_composition_data) data(NHI_nutrient_recommendations) data(nutrient_group) data(sample_diet_USDA) ## contains an example of a one-week diet ## Get daily intake balanceF <- dietBalance(my_daily_food = sample_diet_USDA, food_database = "USDA", age = 27, gender = "female") ## Generate plot nutrientIntakePlot(daily_intake = balanceF)
## Load data data(food_composition_data) data(NHI_nutrient_recommendations) data(nutrient_group) data(sample_diet_USDA) ## contains an example of a one-week diet ## Get daily intake balanceF <- dietBalance(my_daily_food = sample_diet_USDA, food_database = "USDA", age = 27, gender = "female") ## Generate plot nutrientIntakePlot(daily_intake = balanceF)
This function generates a pie-chart of the main foods contributing to the intake levels of a nutrient, based on the output from the function dietBalance().
nutrientPiePlot(daily_intake, nutrient_name = "Vitamin B-12 (ug)", n = 10)
nutrientPiePlot(daily_intake, nutrient_name = "Vitamin B-12 (ug)", n = 10)
daily_intake |
list generated with the function dietBalance(). |
nutrient_name |
character vector indicating the name of the nutrient of interest (e.g. "Vitamin B-12 (ug)". |
n |
maximum number of foods to be displayed. |
A pie-chart showing the contribution (as percentage) of each food to the intake level of a given nutrient.
## Load data data(food_composition_data) data(NHI_nutrient_recommendations) data(nutrient_group) data(sample_diet_USDA) ## contains an example of a one-week diet ## Get daily intake balanceF <- dietBalance(my_daily_food = sample_diet_USDA, food_database = "USDA", age = 27, gender = "female") ## Generate plots nutrientPiePlot(daily_intake = balanceF, nutrient_name = "Fiber, total dietary (g)") nutrientPiePlot(daily_intake = balanceF, nutrient_name = "Magnesium, Mg (mg)") nutrientPiePlot(daily_intake = balanceF, nutrient_name = "Calcium, Ca (mg)") nutrientPiePlot(daily_intake = balanceF, nutrient_name = "Niacin (mg)")
## Load data data(food_composition_data) data(NHI_nutrient_recommendations) data(nutrient_group) data(sample_diet_USDA) ## contains an example of a one-week diet ## Get daily intake balanceF <- dietBalance(my_daily_food = sample_diet_USDA, food_database = "USDA", age = 27, gender = "female") ## Generate plots nutrientPiePlot(daily_intake = balanceF, nutrient_name = "Fiber, total dietary (g)") nutrientPiePlot(daily_intake = balanceF, nutrient_name = "Magnesium, Mg (mg)") nutrientPiePlot(daily_intake = balanceF, nutrient_name = "Calcium, Ca (mg)") nutrientPiePlot(daily_intake = balanceF, nutrient_name = "Niacin (mg)")
This function starts the shiny app for NutrienTrackeR running locally. Personal data and the database of choice should be input in the side panel. Diet should be input in the "Diet input" tab, with one food per line for each day and separating with a semicolon (;) the food name and the eaten amount (in grams). Food names should match those found in the chosen database. A quick assessment of the diet for a 24-h period can be performed from the "One-day diet fast assessment" tab.
NutrienTrackeRapp()
NutrienTrackeRapp()
## Start the NutrienTrackeR shiny app if(interactive()) { NutrienTrackeRapp() }
## Start the NutrienTrackeR shiny app if(interactive()) { NutrienTrackeRapp() }
This function allows visualizing time trends of intake levels of one or several nutrients.
nutrientsTimeTrend(my_daily_food, food_database = "USDA", nutrients = NULL, age = 27, gender = "female", pregnant = FALSE, lactation = FALSE)
nutrientsTimeTrend(my_daily_food, food_database = "USDA", nutrients = NULL, age = 27, gender = "female", pregnant = FALSE, lactation = FALSE)
my_daily_food |
matrix or list of matrices, where each matrix reports a daily intake. The matrix must have two columns: 1)"food" (reporting food names) and 2) "units" (reporting the number of units relative to 100 grams, e.g. 125 g -> 1.25). |
food_database |
character vector indicating the food database to be used. Possible values are: "USDA", "CIQUAL", "BEDCA", "STFCJ". |
nutrients |
character vector indicating the subset of nutrients that will be displayed. NULL indicates that all nutrients will be displayed. |
age |
numeric vector indicating age. |
gender |
character vector indicating gender (i.e. "female" or "male"). |
pregnant |
logical constant indicating pregnancy status. |
lactation |
logical constant indicating lactation status. |
A timeseries plot displaying nutrient intake levels against time.
## Load data data(food_composition_data) data(NIH_nutrient_recommendations) data(nutrient_group) data(sample_diet_USDA) ## contains an example of a one-week diet ## Generate plots nutrientsTimeTrend(my_daily_food = sample_diet_USDA, food_database = "USDA", age = 27, gender = "female") nutrientsTimeTrend(my_daily_food = sample_diet_USDA, food_database = "USDA", nutrients = c("Calcium, Ca (mg)", "Iron, Fe (mg)"), age = 27, gender = "female")
## Load data data(food_composition_data) data(NIH_nutrient_recommendations) data(nutrient_group) data(sample_diet_USDA) ## contains an example of a one-week diet ## Generate plots nutrientsTimeTrend(my_daily_food = sample_diet_USDA, food_database = "USDA", age = 27, gender = "female") nutrientsTimeTrend(my_daily_food = sample_diet_USDA, food_database = "USDA", nutrients = c("Calcium, Ca (mg)", "Iron, Fe (mg)"), age = 27, gender = "female")
This list is an example of a one-week diet, using foods from the USDA database. Each element of the list is a matrix, which includes the all the foods eaten in a given day.
data(sample_diet_USDA)
data(sample_diet_USDA)
List
List
https://ndb.nal.usda.gov/ndb/
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)
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", "STFCJ". |
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")
## 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")