nutrientIntakePlot: Visualize nutrient intake levels

View source: R/Visualization_functions.R

nutrientIntakePlotR Documentation

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, macronutrientsOnly = FALSE and all nutrients will be plotted, including minerals and vitamins.

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)

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