Contents


NutrienTrackeR

Andrea Rodriguez Martinez, Rafael Ayala, Yacine Debbabi, Lara Selles Vidal

Jun 16, 2018


1 Introduction

Motivation: Diet and nutrition play a key role in the development, prevention and treatment of noncommunicable diseases (NCD), such as type 2 diabetes, obesity or cardiovascular diseases (Lachat et al. 2013). For example, inadequate intake of fruits and vegetables contributes to 2.7 million NCD-related deaths per year(Hall et al. 2009). Food and nutrient databases provide the basic infrastructure for the assessment of diet quality and for the development of food-based dietary guidelines (Elmadfa & Meyer 2010; Ahuja et al. 2012).

NutrienTrackeR is a tool set for food information and dietary assessment. It uses food composition data from several reference databases, including: USDA (US), CIQUAL (France), BEDCA (Spain), CIF (Canada) and STFCJ (Japan). NutrienTrackeR calculates the intake levels for both macronutrients and micronutrients, and compares them with the recommended dietary allowances. It also includes a number of visualization tools, such as time series plots of nutrient intake, or pie-charts showing the main foods contributing to the intake levels of a given nutrient.

2 Installation instructions

Before installing NutrienTrackeR, please make sure you have the latest version of R is installed. To install NutrienTrackeR, start R and enter:

install.packages("NutrienTrackeR")

Once installed, the package can be loaded as shown below:

library(NutrienTrackeR)


3 Food composition datasets

NutrienTrackeR includes three different food composition tables, which provide information on the average nutritional value of foods consumed in the United States (USDA standard reference database), France (CIQUAL database) and Spain (BEDCA database). All nutritional values are provided per 100 grams of food.

# USDA dataset
USDA_dataset <- food_composition_data$USDA

# CIQUAL dataset
CIQUAL_dataset <- food_composition_data$CIQUAL

# BEDCA dataset
BEDCA_dataset <- food_composition_data$BEDCA

NutrienTrackeR includes a series of functionalities to facilitate the manipulation of these datasets. For example, the function getNutrientNames() gets the names of all the nutrients included in a given food composition table.

# Get nutrients included in the USDA dataset
nutrients_USDA <- getNutrientNames(food_database = "USDA")
print(head(nutrients_USDA), 4)
## [1] "Water (g)"                       "Energy (kcal)"                  
## [3] "Protein (g)"                     "Total lipid (fat) (g)"          
## [5] "Ash (g)"                         "Carbohydrate, by difference (g)"

The function subsetFoodRichIn() selects the foods with the highest content of a nutrient of interest.

# Top 2 high-protein CIQUAL foods
subsetFoodRichIn(nutrient_name = "Protein (g)", food_database = "CIQUAL", n = 2)[, "food_name"]
##               11007               22004 
##   "Gelatine, dried" "Egg white, powder"
# Top 3 high-protein BEDCA foods within 'Fruits and fruit products'
subsetFoodRichIn(nutrient_name = "Protein (g)", food_database = "BEDCA", food_group = "Fruits and fruit products", n = 3)[, "food_name"]
##              908              946              909 
## "Coconut, dried"   "Peach, dried"   "Coconut, raw"

The function findFoodName() searches for food names based on query keywords.

# Find the USDA food name 'Tomatoes, green, raw'
findFoodName(keywords = c("Tomato", "raw"), food_database = "USDA")
##                                          11527 
##                         "Tomatoes, green, raw" 
##                                          11529 
## "Tomatoes, red, ripe, raw, year round average" 
##                                          11695 
##                        "Tomatoes, orange, raw" 
##                                          11696 
##                        "Tomatoes, yellow, raw"

4 Dietary assessment tools

4.1 Preparing the input

NutrienTrackeR allows assessing the dietary intake of an individual, based on the food composition database of choice (i.e. USDA, CIQUAL or BEDCA). For this, the user needs to provide a 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 eaten (1 unit = 100 grams of food). The dataset sample_diet_USDA is an example of a one-week diet, using foods from the USDA database.

# Foods eaten in day 1
head(sample_diet_USDA[[1]])
##      food                                               units 
## [1,] "Cereals, QUAKER, Quick Oats, Dry"                 "1"   
## [2,] "Oranges, raw, California, valencias"              "0.75"
## [3,] "Kiwifruit, green, raw"                            "0.5" 
## [4,] "Yogurt, plain, low fat"                           "1"   
## [5,] "Tomatoes, green, raw"                             "0.75"
## [6,] "Lettuce, iceberg (includes crisphead types), raw" "0.5"

4.2 Nutrient calculator

The function dietBalance() calculates the daily nutrient intake of an individual and compares it with the NIH recommendations (recommended dietary allowances (RDA) and tolerable upper intake levels (TUIL)). The nutrient requirements are dependent on age and gender, and therefore these parameters need to be specified when using the function dietBalance(). In this example, we will calculate the nutrient intake from the dataset sample_diet_USDA, assuming that this data was provided by a 27-year old women.

# Calculate nutrient intake
daily_intake <- dietBalance(my_daily_food = sample_diet_USDA,
  food_database = "USDA", age = 27, gender = "female")
## The results correspond to an average of 7 days
## Total energy intake (kcal): 1795
## The intake level of the following nutrients is below the RDA:
##                             nutrient proportion(%RDA)         group
## 1                          Water (g)         30.97156 macronutrient
## 2                   Calcium, Ca (mg)         58.25710       mineral
## 3                    Sodium, Na (mg)         59.84527       mineral
## 4                  Potassium, K (mg)         67.10106       mineral
## 5                      Iron, Fe (mg)         99.56111       mineral
## 6           Vitamin D (D2 + D3) (ug)         11.28667       vitamin
## 7  Vitamin E (alpha-tocopherol) (mg)         31.04000       vitamin
## 8                Vitamin A, RAE (ug)         45.67343       vitamin
## 9                Choline, total (mg)         85.32682       vitamin
## 10                  Folate, DFE (ug)         96.62500       vitamin
## The intake level of the following nutrients is above the TUIL:
##             nutrient proportion(%RDA)   group
## 1 Magnesium, Mg (mg)         223.7326 mineral
## 2 Manganese, Mn (mg)         643.8333 mineral

4.3 Visualization tools

The output of dietBalance() can be visualized with several functions. For instance, nutrientIntakePlot() generates a barplot of nutrient intake levels.

nutrientIntakePlot(daily_intake)

The function nutrientPiePlot() generates a pie-chart showing the relative contribution of each food to the total intake of a given nutrient.

# Load ggplott2
library(ggplot2)

## Generate plot
q <- nutrientPiePlot(daily_intake, nutrient_name = "Magnesium, Mg (mg)")

## Adjust font size
q + theme(axis.title = element_text(size = 29), axis.text = element_text(size = 29), legend.title = element_text(size = 22), legend.text = element_text(size = 20))

The function nutrientsTimeTrend() allows visualizing time trends of nutrient intake levels.

# Generate plot
p <- nutrientsTimeTrend(my_daily_food = sample_diet_USDA, food_database = "USDA", nutrients = c("Calcium, Ca (mg)", "Iron, Fe (mg)"))

# Adjust font size
p + theme(axis.title = element_text(size = 18), axis.text = element_text(size = 16), legend.title = element_text(size = 18), legend.text = element_text(size = 18))

4.4 Shiny app

A shiny app is available, which can be run locally by executing NutrienTrackeRapp(). Alternatively, the app can be accessed at https://rafaelayala.shinyapps.io/NutrienTrackeR/

References

Ahuja, J.K.C., Moshfegh, A.J., Holden, J.M. & Harris, E. (2012). USDA food and nutrient databases provide the infrastructure for food and nutrition research, policy, and practice. The Journal of Nutrition, 143, 241S--249S. Retrieved from https://academic.oup.com/jn/article/143/2/241S/4569846
Elmadfa, I. & Meyer, A.L. (2010). Importance of food composition data to nutrition and public health. European Journal of Clinical Nutritionl, 64, 64–67. Retrieved from https://www.nature.com/articles/ejcn2010202
Hall, J.N., Moore, S., Harper, S.B. & Lynch, J.W. (2009). Global variability in fruit and vegetable consumption. American Journal of Preventive Medicine, 36, 402–409. Retrieved from https://www.sciencedirect.com/science/article/pii/S074937970900097X
Lachat, C., Otchere, S., Roberfroid, D., Abdulai, A., Seret, F.M., Milesevic, J., Xuereb, G., Candeias, V. & Kolsteren, P. (2013). Diet and physical activity for the prevention of noncommunicable diseases in low- and middle-income countries: A systematic policy review. Plos Medicine, 10, e1001465. Retrieved from https://journals.plos.org/plosmedicine/article?id=10.1371/journal.pmed.1001465