Skip to content

Commit

Permalink
Merge pull request #47 from nutriverse:dev
Browse files Browse the repository at this point in the history
initial tidying up of spellings
  • Loading branch information
ernestguevarra authored Feb 7, 2025
2 parents bfa34b8 + 8c38b12 commit 03c61d8
Show file tree
Hide file tree
Showing 11 changed files with 102 additions and 129 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ Suggests:
knitr,
testthat (>= 3.0.0),
covr,
spelling
spelling,
tibble
Encoding: UTF-8
Language: en-GB
LazyData: true
Expand Down
53 changes: 23 additions & 30 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
################################################################################
#'
#' Infant and Young Children Indicators Sample Dataset
#' Infant and young child feeding indicators sample dataset
#'
#' This sample demo dataset (`iycfData`) contained 359 observations and 46
#' variables. The following tables explain the detailed description of each
#' variable included in the sample dataset. The CARE International Myanmar
#' Country program provided this demo dataset, and all the Personal
#' Identifiable Information (PII) were excluded.
#' This is an example IYCF dataset with 359 observations and 46
#' variables. The dataset is from CARE International Myanmar country programme.
#' All personally identifiable information have been excluded.
#'
#' @format A data frame with 46 columns and 359 rows.
#'
#'
#' **Variables** | **WHO Question Number** | **Description**
#' :--- | :--- | :---
#' *csex* | | child sex
#' *calc_age_months* | | child age in month
#' *child_bf* | Q1 | ever breastfed
#' *child_eibf* | Q2 | first put to the breast - immediately
#' *child_eibf_hrs* | Q2 | first put to the breast - hours
#' *child_eibf_days* | Q2 | first put to the breast - days
#' *bf_2days* | Q3 | given anything other than breast milk, first 2-days of child age
#' *child_bfyest* | Q4 | breastfed yesterday during the day or at night
#' *bf_bottle* | Q5 | drink anything from a bottle with a nipple yesterday
#' *child_water* | Q6A | Plain water
#' *child_bms* | Q6B | Infant formula
#' *child_bms_freq* | Q6Bnum | Infant formula - frequency
#' *child_milk* | Q6C | Milk from animals
#' *child_milk_freq* | Q6Cnum | Milk from animals - frequency
#' *child_milk_sweet* | Q6Cswt | Milk from animals - sweet or flavored type milk
#' *child_mproduct* | Q6D | Yogurt drinks
#' *child_mproduct_freq* | Q6Dnum | Yogurt drinks - frequency
#' *csex* | | Sex of child; 1 = male; 0 = female.
#' *calc_age_months* | | Age of child in months (calculated).
#' *child_bf* | Q1 | Has child ever been breastfed?; 1 = Yes; 0 = No.
#' *child_eibf* | Q2 | When was child first put to the breast: 0 = immediately; 1 = hours; 2 = days; 999 = Don't know/no response.
#' *child_eibf_hrs* | Q2 | If *child_eibf* is 1, number of hours child first put to the breast; integer value.
#' *child_eibf_days* | Q2 | If *child_eibf* is 2, number of days child first put to the breast; integer value.
#' *bf_2days* | Q3 | Has child been given anything other than breast milk within the child's first 2 days of age? 1 = Yes; 0 = No.
#' *child_bfyest* | Q4 | Has child been breastfed yesterday during the day or at night? 1 = Yes; 0 = No.
#' *bf_bottle* | Q5 | Has child drank anything from a bottle with a nipple yesterday? 1 = Yes; 0 = No.
#' *child_water* | Q6A | Has child drank *plain water* yesterday? 1 = Yes; 0 = No.
#' *child_bms* | Q6B | Has child drank *infant formula* yesterday? 1 = Yes; 0 = No.
#' *child_bms_freq* | Q6Bnum | How many times has child drank *infant formula*? Integer value.
#' *child_milk* | Q6C | Has child drank *milk from animals* yesterday? 1 = Yes; 0 = No.
#' *child_milk_freq* | Q6Cnum | How many times has child drank *milk from animals*? Integer value.
#' *child_milk_sweet* | Q6Cswt | For children who drank *milk from animals*, was milk sweetened or flavoured? 1 = Yes; = No.
#' *child_mproduct* | Q6D | Has child drank *yogurt drinks* yesterday? 1 = Yes; 0 = No.
#' *child_mproduct_freq* | Q6Dnum | How many times has child rank *yogurt drinks*? Integer value.
#' *child_mproduct_sweet* | Q6Dswt | Yogurt drinks - sweet or flavored type yogurt
#' *child_chocolate* | Q6E | Chocolate-flavored drinks
#' *child_juice* | Q6F| Fruit juice or fruit-flavored drinks
Expand Down Expand Up @@ -60,15 +56,12 @@
#' *child_oth_food* | Q7R |Any other solid, semi-solid or soft food
#' *child_food_freq* | Q8 | number of any solid, semi-solid or soft foods yesterday
#'
#'
#' @source CARE Myanmar
#'
#' @examples
#' # explore the first 6 observations from the dataset
#' head(iycfData)
#' iycfData
#'
#
################################################################################

"iycfData"


19 changes: 4 additions & 15 deletions R/get_ebf.R
Original file line number Diff line number Diff line change
@@ -1,26 +1,21 @@
################################################################################
#
#'
#' @title Construct exclusive breastfeeding status for under 6 months old child
#'
#' @description Identification of individual 0-5 months old children exclusive
#' breastfeeding status
#'
#' @param age This parameter holds the information about child age in the month
#' format.
#'
#' @param q4 The binary variable which mentioned that the child was receiving
#' breastfeeding in the previous day (yes = "1", no = "0").
#'
#' @param liquid_food The binary variable which mentioned that the child was
#' receiving any type of liquid foods beside breastfeeding yesterday
#' (yes = 1 or no = 0).
#'
#' @param solid_food The binary variable which mentioned that the child was
#' receiving any type of solid foods yesterday (yes = 1 or no = 0).
#'
#' @return binary variables indicate child was exclusively breastfed or not
#' during the previous day (ebf = 1 or 0)
#'
#' @returns A vector of binary values indicating whether a child was exclusively
#' breastfed or not during the previous day (1 = Yes or 0 = No).
#'
#' @examples
#'
Expand Down Expand Up @@ -53,10 +48,7 @@
#'
#' @author Nicholus Tint Zaw
#' @export
#' @rdname get_ebf
#'
#'
#################################################################################

# Exclusive Breastfeeding
get_ebf <- function(q4, age, liquid_food, solid_food){
Expand All @@ -70,9 +62,6 @@ get_ebf <- function(q4, age, liquid_food, solid_food){
ebf <- ifelse(is.na(q4) | is.na(age) | is.na(liquid_food) |
is.na(solid_food), NA, ebf)

return(ebf)
ebf
}
}

#################################################################################

2 changes: 2 additions & 0 deletions R/get_foodscore.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#' vita_fruveg <- round(runif(nrow(df), min = 0, max = 1), 0)
#' oth_fruveg <- round(runif(nrow(df), min = 0, max = 1), 0)
#'
#################################################################################

#' # Calculate Food Consumption Score
#' food_score <- get_foodscore(breastmilk, grains, pulses, dairy, meat,
#' eggs, vita_fruveg, oth_fruveg)
Expand Down
12 changes: 6 additions & 6 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ knitr::opts_chunk$set(

The first 1,000 days of life (from pregnancy to a child’s 2nd birthday) are critical for addressing childhood malnutrition, especially stunting. Infant and young child feeding practices (IYCF) largely overlap with this period as they cover breastfeeding and complementary feeding practices for the first two years of a child’s life. They also have a significant impact on childhood health, nutrition outcomes, and child survival. It is, therefore, critical for countries to measure IYCF practices as part of their efforts to monitor their progress toward Sustainable Development Goal 2. It is also important for development agencies to be able to monitor and evaluate their programs aimed at improving infant and young child feeding practices towards improved overall childhood nutrition.

WHO and UNICEF released the first IYCF indicators definition and measurement guidelines in 2008. In 2021, these guidelines were updated along with a revised standard questionnaire to capture the information required to calculate the updated IYCF indicators since the first initial publication. In general, the IYCF indicators can be categorized into three main categories: (1) breastfeeding indicators, (2) complementary indicators, and (3) other indicators, which are focused on bottle-feeding practices and the generation of data visualization plots for the breastfeeding status by age.
WHO and UNICEF released the first IYCF indicators definition and measurement guidelines in 2008. In 2021, these guidelines were updated along with a revised standard questionnaire to capture the information required to calculate the updated IYCF indicators since the first initial publication. In general, the IYCF indicators can be categorized into three main categories: *(1) breastfeeding indicators*, *(2) complementary indicators*, and *(3) other indicators*.


## Why riycf package?
## Why the {riycf} package?

Although the initial measurement guidelines were published in 2008 with many humanitarian organizations and country health ministries implementing these indicators, no comprehensive statistical programming package to calculate these indicators is yet available. Therefore, every time the researchers (or humanitarian organizations) are required to collect and analyze, they need a considerable amount of time to re-code all the syntax (depending on which statistical program they are using). That is time-consuming work.
Although the initial measurement guidelines were published in 2008 with many humanitarian organisations and country health ministries implementing these indicators, no comprehensive statistical programming package to calculate these indicators is yet available. Therefore, every time the researchers (or humanitarian organisations) are required to collect and analyse, they need a considerable amount of time to recode all the syntax (depending on which statistical program they are using). That is time-consuming work.

This `{riycf}` package aims to address that technical gap by providing an easy-to-use package of automated functions` to calculate all IYCF indicators provided in the WHO guideline ([the Indicators for assessing infant and young child feeding practices: definitions and measurement methods](https://www.who.int/publications/i/item/9789240018389)). This include comprehensive guidelines for step-by-step usage of each automated function to analyze individual IYCF indicators in R software to make it easier for those less familiar with R software.
This `{riycf}` package aims to address that technical gap by providing an easy-to-use package of functions to calculate all IYCF indicators provided in the [WHO guidelines](https://www.who.int/publications/i/item/9789240018389). This include comprehensive guidelines for step-by-step usage of each automated function to analyse individual IYCF indicators using R.


## Installation
Expand Down Expand Up @@ -66,7 +66,7 @@ Based on the WHO guideline’s indicator definition, the `{riycf}` package funct

### (Beneficial in) Data cleaning

Each IYCF package function will perform the data quality check to ensure all the required data (variables) were correctly constructed in the dataset. For example, the minimum meal frequency indicator analysis requires the following variables for data analysis: child age, breastfeeding status, and frequency of child feeding on the previous day. The child age and child meal frequency data should be present in the `numeric - integer` format, and the breastfeeding status should be coded as a binary true/false variable with yes = 1 and no = 0. The riycf package function will ensure that integer variables are actually integers and variables that need to be re-coded into numeric scores are re-coded.
Each IYCF package function will perform the data quality check to ensure all the required data (variables) were correctly constructed in the dataset. For example, the minimum meal frequency indicator analysis requires the following variables for data analysis: child age, breastfeeding status, and frequency of child feeding on the previous day. The child age and child meal frequency data should be present in the `numeric - integer` format, and the breastfeeding status should be coded as a binary true/false variable with yes = 1 and no = 0. The `{riycf}` package function will ensure that integer variables are actually integers and variables that need to be recoded into numeric scores are recoded accordingly.

### IYCF indicator generation

Expand All @@ -75,7 +75,7 @@ The indicator calculation process would continue if there were no issues with th

## Data collection with computer-assisted personal interviews (CAPI)

This package also provides the already programmed IYCF Questionnaires (based on WHO sample IYCF questionnaires) in XLS programming format. Detailed guidelines for accessing those forms are provided in the vignette article called "WHO IYCF Questionnaire XLS Forms." The different types of XLS programmed IYCF questionnaires can download on [this Github page](https://github.com/nicholustintzaw/iycf_xls_forms).
This package also provides the already programmed IYCF Questionnaires (based on WHO sample IYCF questionnaires) in XLS programming format. Detailed guidelines for accessing those forms are provided in the vignette article called "WHO IYCF Questionnaire XLS Forms." The different types of XLS programmed IYCF questionnaires can download on [this GitHub page](https://github.com/nicholustintzaw/iycf_xls_forms).

## Citation

Expand Down
34 changes: 15 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,26 @@ measurement guidelines in 2008. In 2021, these guidelines were updated
along with a revised standard questionnaire to capture the information
required to calculate the updated IYCF indicators since the first
initial publication. In general, the IYCF indicators can be categorized
into three main categories: (1) breastfeeding indicators, (2)
complementary indicators, and (3) other indicators, which are focused on
bottle-feeding practices and the generation of data visualization plots
for the breastfeeding status by age.
into three main categories: *(1) breastfeeding indicators*, *(2)
complementary indicators*, and *(3) other indicators*.

## Why riycf package?
## Why the {riycf} package?

Although the initial measurement guidelines were published in 2008 with
many humanitarian organizations and country health ministries
many humanitarian organisations and country health ministries
implementing these indicators, no comprehensive statistical programming
package to calculate these indicators is yet available. Therefore, every
time the researchers (or humanitarian organizations) are required to
collect and analyze, they need a considerable amount of time to re-code
time the researchers (or humanitarian organisations) are required to
collect and analyse, they need a considerable amount of time to recode
all the syntax (depending on which statistical program they are using).
That is time-consuming work.

This `{riycf}` package aims to address that technical gap by providing
an easy-to-use package of automated functions\` to calculate all IYCF
indicators provided in the WHO guideline ([the Indicators for assessing
infant and young child feeding practices: definitions and measurement
methods](https://www.who.int/publications/i/item/9789240018389)). This
an easy-to-use package of functions to calculate all IYCF indicators
provided in the [WHO
guidelines](https://www.who.int/publications/i/item/9789240018389). This
include comprehensive guidelines for step-by-step usage of each
automated function to analyze individual IYCF indicators in R software
to make it easier for those less familiar with R software.
automated function to analyse individual IYCF indicators using R.

## Installation

Expand Down Expand Up @@ -99,10 +95,10 @@ requires the following variables for data analysis: child age,
breastfeeding status, and frequency of child feeding on the previous
day. The child age and child meal frequency data should be present in
the `numeric - integer` format, and the breastfeeding status should be
coded as a binary true/false variable with yes = 1 and no = 0. The riycf
package function will ensure that integer variables are actually
integers and variables that need to be re-coded into numeric scores are
re-coded.
coded as a binary true/false variable with yes = 1 and no = 0. The
`{riycf}` package function will ensure that integer variables are
actually integers and variables that need to be recoded into numeric
scores are recoded accordingly.

### IYCF indicator generation

Expand All @@ -122,7 +118,7 @@ This package also provides the already programmed IYCF Questionnaires
Detailed guidelines for accessing those forms are provided in the
vignette article called “WHO IYCF Questionnaire XLS Forms.” The
different types of XLS programmed IYCF questionnaires can download on
[this Github page](https://github.com/nicholustintzaw/iycf_xls_forms).
[this GitHub page](https://github.com/nicholustintzaw/iycf_xls_forms).

## Citation

Expand Down
19 changes: 7 additions & 12 deletions data-raw/processData.R
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@

# SAMPLE DATASET for IYCF INDICATORS EXAMPLE

################################################################################

# Breastfeeding Sample Data
## Breastfeeding Sample Data
bfData <- read.csv("data-raw/bf_data.csv")

# usethis::use_data(bfData, overwrite = TRUE, compress = "xz")

################################################################################

# Complementary Feeding Sample Data
## Complementary Feeding Sample Data
cfData <- read.csv("data-raw/iycf_data.csv")
# usethis::use_data(cfData, overwrite = TRUE, compress = "xz")

# IYCF Dataset - CARE Myanmar Sample data

## IYCF Dataset - CARE Myanmar Sample data
iycfData <- rbind(bfData, cfData)

# required additional variable creation - to matched with WHO questionnaires
## required additional variable creation - to matched with WHO questionnaires
iycfData$bf_2days <- rbinom(n = nrow(iycfData), size = 1, prob = 0.3)
iycfData$bf_bottle <- rbinom(n = nrow(iycfData), size = 1, prob = 0.15)
iycfData$child_milk_sweet <- rbinom(n = nrow(iycfData), size = 1, prob = 0.3)
Expand Down Expand Up @@ -58,9 +56,6 @@ final_var <- c('csex', 'calc_age_months', 'child_bf', 'child_eibf',
'child_fish', 'child_beans', 'child_cheese', 'child_sweets',
'child_snack', 'child_oth_food', 'child_food_freq')

iycfData <- iycfData[, final_var]
iycfData <- tibble::as_tibble(iycfData[, final_var])

usethis::use_data(iycfData, overwrite = TRUE, compress = "xz")


################################################################################
Binary file modified data/iycfData.rda
Binary file not shown.
4 changes: 2 additions & 2 deletions man/get_ebf.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 03c61d8

Please sign in to comment.