Type: | Package |
Title: | Food Composition Information and Dietary Assessment |
Version: | 1.3.0 |
Date: | 2023-07-10 |
Maintainer: | Rafael Ayala <rafael.ayala@oist.jp> |
Contact: | Andrea Rodriguez-Martinez <andrea.rodriguez-martinez13@imperial.ac.uk>, Rafael Ayala <rafael.ayala@oist.jp> |
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. |
License: | GPL-3 |
Depends: | R(≥ 3.5) |
Suggests: | RUnit, knitr, BiocStyle, rmarkdown, BiocGenerics |
VignetteBuilder: | knitr |
Imports: | ggplot2, shiny |
NeedsCompilation: | no |
LazyData: | true |
Encoding: | UTF-8 |
Packaged: | 2023-07-10 08:28:14 UTC; rafael |
Author: | Andrea Rodriguez-Martinez [aut],
Rafael Ayala |
Repository: | CRAN |
Date/Publication: | 2023-07-10 20:00:04 UTC |
Nutrient recommendations
Description
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.
Usage
data(NIH_nutrient_recommendations)
Format
List
Value
List
Starts shiny app for NutrienTrackeR
Description
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.
Usage
NutrienTrackeRapp()
Examples
## Start the NutrienTrackeR shiny app
if(interactive()) {
NutrienTrackeRapp()
}
Nutrition calculator
Description
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)).
Usage
dietBalance(my_daily_food, food_database = "USDA", age = 27, gender = "female",
pregnant = FALSE, lactation = FALSE, summary_report = TRUE)
Arguments
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. |
Value
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.
References
https://ndb.nal.usda.gov/ndb/
http://www.bedca.net/
https://ciqual.anses.fr/
Examples
## 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")
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", "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. |
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")
Nutritional values for common foods and products
Description
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.
Usage
data(food_composition_data)
Format
List
Value
List
References
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
Get the names of the food groups included in a given database
Description
This function returns the names of the different food groups included in a given database.
Usage
getFoodGroups(food_database = "USDA")
Arguments
food_database |
character vector indicating the food database to be used. Possible values are: "USDA", "CIQUAL", "BEDCA", "CNF", "STFCJ". |
Value
A vector of food groups.
Examples
## 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")
Get the names of nutrients included in a given database
Description
This function returns the names of all nutrients included in a given database.
Usage
getNutrientNames(food_database = "USDA")
Arguments
food_database |
character vector indicating the food database to be used. Possible values are: "USDA", "CIQUAL", "BEDCA", "CNF", "STFCJ". |
Value
A vector of nutrient names.
Examples
## 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")
Visualize nutrient intake levels
Description
This function generates a barplot of nutrient intake levels, based on the output generated with the function dietBalance().
Usage
nutrientIntakePlot(daily_intake, color_scale = c("salmon", "cornflowerblue",
"palegreen3"), macronutrientsOnly = FALSE)
Arguments
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, |
Value
A barplot of nutrient intake levels, expressed as a percentage of RDA.
Examples
## 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)
Visualize the main foods contributing to the intake levels of a nutrient
Description
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().
Usage
nutrientPiePlot(daily_intake, nutrient_name = "Vitamin B-12 (ug)", n = 10)
Arguments
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. |
Value
A pie-chart showing the contribution (as percentage) of each food to the intake level of a given nutrient.
Examples
## 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)")
Nutrient groups
Description
This matrix contains nutrient names and groups, for all nutrients included in the NIH_nutrient_recommendations dataset.
Usage
data(nutrient_group)
Format
Matrix
Value
List
References
https://www.nih.gov/
Visualize time trends of nutrient intake levels
Description
This function allows visualizing time trends of intake levels of one or several nutrients.
Usage
nutrientsTimeTrend(my_daily_food, food_database = "USDA", nutrients = NULL,
age = 27, gender = "female", pregnant = FALSE, lactation = FALSE)
Arguments
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. |
Value
A timeseries plot displaying nutrient intake levels against time.
Examples
## 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")
Example of a one-week diet
Description
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.
Usage
data(sample_diet_USDA)
Format
List
Value
List
References
https://ndb.nal.usda.gov/ndb/
Find nutrient-rich foods
Description
This function selects the foods with the highest amount of a given nutrient from a food composition database.
Usage
subsetFoodRichIn(nutrient_name, food_database = "USDA", food_group = NULL, n = 10)
Arguments
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. |
Value
A subset from the food composition database containing the foods with the highest amount of the nutrient of interest.
Examples
## 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")