Skip to contents

This function calculates the percentage of districts where coverage for specific health indicators falls below a 10% threshold, for each year. The function generates a binary variable for each indicator, denoting whether it is below 10%, and then calculates the average percentage of below-threshold coverage for each indicator.

Usage

calculate_indicator_threshold_coverage(.data)

Arguments

.data

A data frame or tibble containing health indicator coverage data with columns named in the format cov_<indicator>_<source>, where <indicator> is one of "zerodose", "undervax", "dropout_penta13", "dropout_measles12", "dropout_penta3mcv1", or "dropout_penta1mcv1", and <source> is one of "dhis2", "penta1", or "anc1".

Value

A tibble with the yearly average percentage of below-threshold coverage for each indicator-source combination, where each value represents the percentage of districts with below 10% coverage for that indicator and source.

Details

The function performs the following steps:

  1. Generate Binary Below-Threshold Variables: For each indicator-source combination, it generates a binary variable indicating if coverage is below 10% (1 if below 10% and 0 otherwise).

  2. Rename Columns: The generated columns are renamed by removing the cov_ prefix.

  3. Summarize: The function then calculates the mean of each below-threshold indicator across all districts, grouped by year, resulting in the percentage of districts below 10% for each indicator-source.

  4. Round to Percentage: The percentages are then multiplied by 100 and rounded to one decimal place. Any missing values are set to 0%.

Examples

if (FALSE) { # \dontrun{
  # Assuming `data` is a data frame with required columns:
  result <- calculate_indicator_threshold_coverage(data)
  result
} # }