Skip to contents

Computes Minimum Dietary Diversity (MDD) and Dietary Diversity Score (DDS) for women, men, adolescents, or children, from cleaned dietary recall data.

Usage

compute_mdd(
  recall_data,
  id_col,
  food_item_col,
  life_stage,
  use_fct_db = FALSE,
  fg_map_data = NULL,
  fg_map_food = NULL,
  fg_map_col = NULL,
  breastfeeding_data = NULL,
  breastfeeding_col = NULL
)

Arguments

recall_data

A data frame of recall data containing at least the ID column and the food item column.

id_col

Character. Name of the identifier column in recall_data (e.g., "survey_id").

food_item_col

Character. Name of the column in recall_data containing food item names.

life_stage

One of "woman", "man", "adolescent", "child".

use_fct_db

Logical, default = FALSE. If TRUE, uses the package's online FCT mapping database for food group classification.

fg_map_data

Optional. A user-provided mapping data frame with food items and food groups. Required if use_fct_db = FALSE.

fg_map_food

Character. Column name in fg_map_data that matches food items.

fg_map_col

Character. Column name in fg_map_data that contains the food group.

breastfeeding_data

Optional. Data frame with ID and breastfeeding status (binary). Only relevant if life_stage = "child".

breastfeeding_col

Character. Column name in breastfeeding_data that contains breastfeeding status.

Value

A tibble with:

  • The ID column (as provided in id_col)

  • One-hot encoded food group indicators

  • dds_<life_stage> = Dietary Diversity Score

  • mdd_<life_stage> = Binary indicator of meeting MDD

Details

  • For children: threshold is >=5 if breastfeeding included, >=4 otherwise.

  • For adults (woman, man, adolescent): threshold is always >=5.

  • Warns if unmapped food items are found in recall data.

  • Final result for children returns the expected 7 food groups and adults returns the expected 10 food group, even if not mapped to any food item

  • While Others food group are part of the result, the column is not included in the summation of food groups for dds

Examples

if (FALSE) { # \dontrun{
# Using online FCT DB
result <- compute_mdd(
  recall_data = dietrecall_example$food_details,
  id_col = "survey_id",
  food_item_col = "desc_of_food",
  life_stage = "woman",
  use_fct_db = TRUE
)

# Using custom mapping
fg_map <- data.frame(
  item = c("Ugali", "Milk"),
  group = c("Cereals", "Dairy")
)

result <- compute_mdd(
  recall_data = dietrecall_example$food_details,
  id_col = "survey_id",
  food_item_col = "desc_of_food",
  life_stage = "child",
  use_fct_db = FALSE,
  fg_map_data = fg_map,
  fg_map_food = "item",
  fg_map_col = "group",
  breastfeeding_data = dietrecall_example$maintable,
  breastfeeding_col = "child_breastfed"
)
} # }