Skip to contents

Compute total contribution of the current diet regarding each outcome of interest.

Usage

compute_total_contrib(data_diet, data_perunit_contrib)

Arguments

data_diet

A dataframe where diet intake information is stored

data_perunit_contrib

A dataframe where contribution per unit for each tag_outcome is stored. This could also be the standardized contribution per unit.

Value

A list of outputs:

  • total_contrib stores the total contribution of the current diet

  • tag_food stores the names of foods

  • tag_outcome stores the names of outcomes

Examples

diet_selected <- select_diet(data_diet = all_diet,
                      tag_food = c('Bread', 'Vegetables', 'Red meat'))

cpu_selected <- select_perunit(data_perunit_contrib = contrib_per_unit, 
                        tag_food = c('Bread', 'Vegetables', 'Red meat'), 
                        tag_outcome = c('energy', 'protein', 'ghge'))

compute_total_contrib(data_diet = diet_selected, 
                      data_perunit_contrib = cpu_selected)
#> $total_contrib
#>   tag_outcome total_contrib
#> 1      energy   3327.249302
#> 2     protein     41.442989
#> 3        ghge      2.006292
#> 
#> $tag_food
#> [1] "Bread"      "Vegetables" "Red meat"  
#> 
#> $tag_outcome
#> [1] "energy"  "protein" "ghge"   
#>