Title: | Utilities for Calculating Dietary Intake Indicators for Food Security Assessments |
---|---|
Description: | Food security assessments utilise several dietary intake indicators as proxy measures for diet quality, diet sufficiency, and food availability either at individual or household level. Utilities for recoding and calculating these indicators support in establishing consistent and reliable results. |
Authors: | Ernest Guevarra [aut, cre] |
Maintainer: | Ernest Guevarra <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.0.0.9000 |
Built: | 2024-12-11 05:29:00 UTC |
Source: | https://github.com/nutriverse/dietry |
Calculate Food Consumption Score (FCS)
fcs_calculate(df, var_map, weights = NULL, add = TRUE)
fcs_calculate(df, var_map, weights = NULL, add = TRUE)
df |
A data.frame with FCS data. |
var_map |
A named list of FCS food groups mapped to corresponding
variable names in |
weights |
A numeric vector of FCS weights applied to corresponding food groups. The weights should be ordered as that for staples, pulses, vegetables, fruits, meat and fish, dairy, sugar, oil, and condiments. Default to NULL which uses the weights based on current FCS recommendations. Only change this if new recommendations have been provided or for testing/studying new/experimental FCS weighting systems. |
add |
Logical. Should the resulting FCS scores be added to |
If add = TRUE
, a data.frame based on df
with a new variable
named fcs
for the calculated food consumption scores. Otherwise, a
numeric vector of the calculated food consumption scores.
Ernest Guevarra
var_map <- fcs_fg_map_variables( staples = "FCSStap", pulses = "FCSPulse", vegetables = "FCSVeg", fruits = "FCSFruit", meatfish = "FCSPr", milk = "FCSDairy", sugar = "FCSSugar", oil = "FCSFat", condiment = "FCSCond" ) fcs_calculate(df = fcs01, var_map = var_map)
var_map <- fcs_fg_map_variables( staples = "FCSStap", pulses = "FCSPulse", vegetables = "FCSVeg", fruits = "FCSFruit", meatfish = "FCSPr", milk = "FCSDairy", sugar = "FCSSugar", oil = "FCSFat", condiment = "FCSCond" ) fcs_calculate(df = fcs01, var_map = var_map)
Classify Food Consumption Score (FCS)
fcs_classify(fcs, cutoff = NULL, add = FALSE, spread = FALSE)
fcs_classify(fcs, cutoff = NULL, add = FALSE, spread = FALSE)
fcs |
A vector of food consumption scores. |
cutoff |
A numeric vector of length 2 for the cut-offs to use for classifying FCS. Default to NULL in which case standard recommended cut-off values for FCS are used. |
add |
Logical. Should classification be column bound to fcs? Default to FALSE. |
spread |
Logical. Should classification be spread into columns? Default to FALSE. |
If spread = TRUE
, a data.frame with number of rows equal to the
length of fcs
and number of columns equal to length of fill
plus an
initial column named fcs
containing the FCS values provided by fcs
argument if add = TRUE
. Otherwise, a vector of class factor containing
FCS classifications. If add = TRUE
, this vector is concatenated with the
fcs
values in a data.frame.
Ernest Guevarra
var_map <- fcs_fg_map_variables( staples = "FCSStap", pulses = "FCSPulse", vegetables = "FCSVeg", fruits = "FCSFruit", meatfish = "FCSPr", milk = "FCSDairy", sugar = "FCSSugar", oil = "FCSFat", condiment = "FCSCond" ) fcs <- fcs_calculate(df = fcs01, var_map = var_map) fcs_classify(fcs$fcs)
var_map <- fcs_fg_map_variables( staples = "FCSStap", pulses = "FCSPulse", vegetables = "FCSVeg", fruits = "FCSFruit", meatfish = "FCSPr", milk = "FCSDairy", sugar = "FCSSugar", oil = "FCSFat", condiment = "FCSCond" ) fcs <- fcs_calculate(df = fcs01, var_map = var_map) fcs_classify(fcs$fcs)
Get Food Consumption Score (FCS) colours
fcs_get_colours()
fcs_get_colours()
A named character vector of recommended FCS classification colours
Ernest Guevarra
fcs_get_colours()
fcs_get_colours()
Recode Food Consumption Score (FCS) data
fcs_recode(x, na_values = NULL)
fcs_recode(x, na_values = NULL)
x |
A vector of numeric values that can range from 0 to 7 for the number of days in a week that a food group is eaten by a household as per FCS guidelines. |
na_values |
A value or a vector of values that are to be considered as NA. Default to NA. |
An integer vector with possible values ranging from 0 to 7.
Ernest Guevarra
fcs_recode(fcs01$FCSStap)
fcs_recode(fcs01$FCSStap)
Sample Food Consumption Score (FCS) data from World Food Programme (WFP) VAM Resource Centre
fcs01
fcs01
A data frame with 18 columns and 26 rows:
Variable | Description |
FCSStap | Integer value from 0-7 for consumption frequency of staples |
FCSStap_SRf | Staples food source |
FCSVeg | Integer value from 0-7 for consumption frequency of vegetables |
FCSVeg_SRf | Vegetables food source |
FCSFruit | Integer value from 0-7 for consumption frequency of fruits |
FCSFruit_SRf | Fruits food source |
FCSPr | Integer value from 0-7 for consumption frequency of protein-rich foods |
FCSPr_SRf | Protein-rich food source |
FCSPulse | Integer value from 0-7 for consumption frequency of pulses |
FCSPulse_SRf | Pulses food source |
FCSDairy | Integer value from 0-7 for consumption frequency of dairy |
FCSDairy_SRf | Dairy food source |
FCSSugar | Integer value from 0-7 for consumption frequency of sugary foods |
FCSSugar_SRf | Sugary food source |
FCSFat | Integer value from 0-7 for consumption frequency of fats |
FCSFat_SRf | Fats food source |
FCSCond | Integer value from 0-7 for consumption frequency of condiments |
FCSCond_SRf | Condiments food source |
https://github.com/WFP-VAM/RAMResourcesScripts/blob/main/Static/FCS_Sample_Survey.csv
fcs01
fcs01
Map data variables to corresponding indicators
map_variables(...) fcs_fg_map_variables( ..., foodgroups = c("staples", "pulses", "vegetables", "fruits", "meatfish", "milk", "sugar", "oil", "condiment") ) hdds_fg_map_variables( ..., foodgroups = c("cereals", "roots_tubers", "vegetables", "fruits", "meat", "eggs", "fish", "pulses", "milk", "oil", "sugar", "condiments") ) mddw_fg_map_variables( ..., foodgroups = c("staples", "pulses", "nuts", "milk", "meat_fish", "eggs", "green_leafy", "other_vita", "other_vegetables", "other_fruits") )
map_variables(...) fcs_fg_map_variables( ..., foodgroups = c("staples", "pulses", "vegetables", "fruits", "meatfish", "milk", "sugar", "oil", "condiment") ) hdds_fg_map_variables( ..., foodgroups = c("cereals", "roots_tubers", "vegetables", "fruits", "meat", "eggs", "fish", "pulses", "milk", "oil", "sugar", "condiments") ) mddw_fg_map_variables( ..., foodgroups = c("staples", "pulses", "nuts", "milk", "meat_fish", "eggs", "green_leafy", "other_vita", "other_vegetables", "other_fruits") )
... |
Name-value pairs. Name gives the labels for indicators. The value should be the corresponding variable name in a dataset used for that indicator. |
foodgroups |
A character vector of food group labels for a specific dietary intake indicator set. |
A named list of variable name/s for corresponding food groups.
## Variable names in fcs01 mapped to corresponding food group labels map_variables( staples = "FCSStap", pulses = "FCSPulse", vegetables = "FCSVeg", fruits = "FCSFruit", meatfish = "FCSPr", milk = "FCSDairy", sugar = "FCSSugar", oil = "FCSFat", condiment = "FCSCond" )
## Variable names in fcs01 mapped to corresponding food group labels map_variables( staples = "FCSStap", pulses = "FCSPulse", vegetables = "FCSVeg", fruits = "FCSFruit", meatfish = "FCSPr", milk = "FCSDairy", sugar = "FCSSugar", oil = "FCSFat", condiment = "FCSCond" )