Producing JMP estimates

WASH in healthcare facilities

Published

March 15, 2024

Introduction

This project aims to run an analysis to Water, Sanitation, Hygiene, Healthcare Waste Management and Environmental Cleaning (WASH) assessment in healthcare facilities. The analysis follows the World Health Organization (WHO) and the United Nations Children’s Fund (UNICEF) Joint Monitoring Programme for Water Supply, Sanitation and Hygiene (JMP) methodology to produce basic, limited and no service estimates. The sample is nationally representative according to the JMP methodology.

Methods

The dataset contains the results of a WASH assessment in healthcare facilities carried out in one of the Member States. The WASH indicators are:

  • Water
  • Sanitation
  • Hygiene
  • Healthcare Waste Management
  • Environmental Cleaning

Calculating the estimates follows the JMP methodology.

Import and reading

Import libraries and reading the data

Code
#| label: load-packages
#| warning: false

# import libraries 
library(readr)
library(tidyverse)
library(dplyr)
library(ggthemes)
library(ggplot2)
library(knitr)

# reading file
data <- read_csv(here::here("data/processed/WinHCFs_microdata.csv"))
#glimpse(data)

Stratifiers

Each stratifier includes more than 50 facilities. According to the JMP methodology, estimates can be produced for each stratifier.

Code
total_sample <- data |>
  count()

total_urban <- data |>
  filter(`urban/rural` == "Urban") |>
  count()

total_rural <- data |>
  filter(`urban/rural` == "Rural") |>
  count()

total_hospital <- data |>
  filter(`hospital/non-hospital` == "Hospital") |>
  count()

total_nonhospital <- data |>
  filter(`hospital/non-hospital` == "Non-Hospital") |>
  count()

total_public <- data |>
  filter(`public/private` == "Public") |>
  count()

total_private <- data |>
  filter(`public/private` == "Private") |>
  count()

Water Data

Improved sources

Calculating improved water source for each stratifier

Code
# calculating improved water source
GW1 <- data |>
  select(GW1, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gw1 <- GW1 |>
  count(GW1) |>
  mutate(Total = (n / sum(n))*100) |>
  select(GW1, Total)

urban_gw1 <- GW1 |>
  filter(`urban/rural`== "Urban") |>
  count(GW1) |>
  mutate(Urban = (n / sum(n))*100)|>
  select(GW1, Urban)

rural_gw1 <- GW1 |>
  filter(`urban/rural`== "Rural") |>
  count(GW1) |>
  mutate(Rural = (n / sum(n))*100)|>
  select(GW1, Rural)

hospital_gw1 <- GW1 |>
  filter(`hospital/non-hospital` == "Hospital") |>
  count(GW1) |>
  mutate(Hospital = (n / sum(n))*100)|>
  select(GW1, Hospital)

nonhospital_gw1 <- GW1 |>
  filter(`hospital/non-hospital` == "Non-Hospital") |>
  count(GW1) |>
  mutate(Nonhospital = (n / sum(n))*100)|>
  select(GW1, Nonhospital)

public_gw1 <- GW1 |>
  filter(`public/private` == "Public") |>
  count(GW1) |>
  mutate(Public = (n / sum(n))*100)|>
  select(GW1, Public)

private_gw1 <- GW1 |>
  filter(`public/private` == "Private") |>
  count(GW1) |>
  mutate(Private = (n / sum(n))*100)|>
  select(GW1, Private)

# joining
water_source <- total_gw1 |>
  left_join(urban_gw1) |>
  left_join(rural_gw1) |>
  left_join(hospital_gw1) |>
  left_join(nonhospital_gw1) |>
  left_join(public_gw1) |>
  left_join(private_gw1)

# replacing NA with zero
water_source <- water_source |>
  replace(is.na(water_source), 0)

# calculate improved
improved_water_source <- water_source |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole"
        ) |>
  summarise_at(vars(Total, Urban, Rural, Hospital, Nonhospital, Public, Private), sum)|>
  mutate(Indicator = "Improved water source") |>
  relocate(Indicator, .before = Total)

# calculate no service
no_service_water <- water_source |>
  filter(GW1 == "Don't Know" |
         GW1 == "No water source or patients bring water from home" |
         GW1 == "Other" |
         GW1 == "Unprotected dug well"
        ) |>
  summarise_at(vars(Total, Urban, Rural, Hospital, Nonhospital, Public, Private), sum) |>
  mutate(Indicator = "No service") |>
  relocate(Indicator, .before = Total)

On premises

Calculating on premises indicator for each stratifier

Code
# calculate on premises
GW2 <- data |>
  select(GW2, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gw2 <- GW2 |>
  count(GW2) |>
  mutate(Total = (n / sum(n))*100) |>
  select(GW2, Total) |>
  filter(GW2 == "On premises")

urban_gw2 <- GW2 |>
  filter(`urban/rural`== "Urban") |>
  count(GW2) |>
  mutate(Urban = (n / sum(n))*100)|>
  select(GW2, Urban) |>
  filter(GW2 == "On premises")

rural_gw2 <- GW2 |>
  filter(`urban/rural`== "Rural") |>
  count(GW2) |>
  mutate(Rural = (n / sum(n))*100)|>
  select(GW2, Rural)|>
  filter(GW2 == "On premises")

hospital_gw2 <- GW2 |>
  filter(`hospital/non-hospital` == "Hospital") |>
  count(GW2) |>
  mutate(Hospital = (n / sum(n))*100)|>
  select(GW2, Hospital)|>
  filter(GW2 == "On premises")

nonhospital_gw2 <- GW2 |>
  filter(`hospital/non-hospital` == "Non-Hospital") |>
  count(GW2) |>
  mutate(Nonhospital = (n / sum(n))*100)|>
  select(GW2, Nonhospital)|>
  filter(GW2 == "On premises")

public_gw2 <- GW2 |>
  filter(`public/private` == "Public") |>
  count(GW2) |>
  mutate(Public = (n / sum(n))*100)|>
  select(GW2, Public)|>
  filter(GW2 == "On premises")

private_gw2 <- GW2 |>
  filter(`public/private` == "Private") |>
  count(GW2) |>
  mutate(Private = (n / sum(n))*100)|>
  select(GW2, Private)|>
  filter(GW2 == "On premises")

# joining
on_premises <- total_gw2 |>
  left_join(urban_gw2) |>
  left_join(rural_gw2) |>
  left_join(hospital_gw2) |>
  left_join(nonhospital_gw2) |>
  left_join(public_gw2) |>
  left_join(private_gw2) |>
  rename(Indicator = GW2)

Availability

Calculating water availability indicator for each stratifier

Code
# calculate availability
GW3 <- data |>
  select(GW3, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gw3 <- GW3 |>
  count(GW3) |>
  mutate(Total = (n / sum(n))*100) |>
  select(GW3, Total) |>
  filter(GW3 == "Yes")

urban_gw3 <- GW3 |>
  filter(`urban/rural`== "Urban") |>
  count(GW3) |>
  mutate(Urban = (n / sum(n))*100)|>
  select(GW3, Urban) |>
  filter(GW3 == "Yes")

rural_gw3 <- GW3 |>
  filter(`urban/rural`== "Rural") |>
  count(GW3) |>
  mutate(Rural = (n / sum(n))*100)|>
  select(GW3, Rural)|>
  filter(GW3 == "Yes")

hospital_gw3 <- GW3 |>
  filter(`hospital/non-hospital` == "Hospital") |>
  count(GW3) |>
  mutate(Hospital = (n / sum(n))*100)|>
  select(GW3, Hospital)|>
  filter(GW3 == "Yes")

nonhospital_gw3 <- GW3 |>
  filter(`hospital/non-hospital` == "Non-Hospital") |>
  count(GW3) |>
  mutate(Nonhospital = (n / sum(n))*100)|>
  select(GW3, Nonhospital)|>
  filter(GW3 == "Yes")

public_gw3 <- GW3 |>
  filter(`public/private` == "Public") |>
  count(GW3) |>
  mutate(Public = (n / sum(n))*100)|>
  select(GW3, Public)|>
  filter(GW3 == "Yes")

private_gw3 <- GW3 |>
  filter(`public/private` == "Private") |>
  count(GW3) |>
  mutate(Private = (n / sum(n))*100)|>
  select(GW3, Private)|>
  filter(GW3 == "Yes")

# joining
available <- total_gw3 |>
  left_join(urban_gw3) |>
  left_join(rural_gw3) |>
  left_join(hospital_gw3) |>
  left_join(nonhospital_gw3) |>
  left_join(public_gw3) |>
  left_join(private_gw3) |>
  mutate(Indicator = "Available",
         GW3= NULL) |>
  relocate(Indicator, .before = Total)

Improved and available

Calculating improved and available water indicator for each stratifier

Code
# calculating improved and available
GW13 <- data |>
  select(GW1, GW3, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gw13 <- GW13 |>
  filter(GW3 == "Yes") |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole") |>
  count(GW3) |>
  mutate(Total = (n / total_sample)*100) |>
  select(GW3, Total)

urban_gw13 <- GW13 |>
  filter(`urban/rural`== "Urban") |>
  filter(GW3 == "Yes") |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole") |>
  count(GW3) |>
  mutate(Urban = (n / total_urban)*100) |>
  select(GW3, Urban)

rural_gw13 <- GW13 |>
  filter(`urban/rural`== "Rural") |>
  filter(GW3 == "Yes") |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole") |>
  count(GW3) |>
  mutate(Rural = (n / total_rural)*100) |>
  select(GW3, Rural)


hospital_gw13 <- GW13 |>
  filter(`hospital/non-hospital`== "Hospital") |>
  filter(GW3 == "Yes") |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole") |>
  count(GW3) |>
  mutate(Hospital = (n / total_hospital)*100) |>
  select(GW3, Hospital)

nonhospital_gw13 <- GW13 |>
  filter(`hospital/non-hospital`== "Non-Hospital") |>
  filter(GW3 == "Yes") |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole") |>
  count(GW3) |>
  mutate(Nonhospital = (n / total_nonhospital)*100) |>
  select(GW3, Nonhospital)

public_gw13 <- GW13 |>
  filter(`public/private`== "Public") |>
  filter(GW3 == "Yes") |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole") |>
  count(GW3) |>
  mutate(Public = (n / total_public)*100) |>
  select(GW3, Public)

private_gw13 <- GW13 |>
  filter(`public/private`== "Private") |>
  filter(GW3 == "Yes") |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole") |>
  count(GW3) |>
  mutate(Private = (n / total_private)*100) |>
  select(GW3, Private)

# joining
improved_available <- total_gw13 |>
  left_join(urban_gw13) |>
  left_join(rural_gw13) |>
  left_join(hospital_gw13) |>
  left_join(nonhospital_gw13) |>
  left_join(public_gw13) |>
  left_join(private_gw13) |>
  mutate(Indicator = "Improved and available",
         GW3 = NULL,
         Total =  Total$n,
         Urban = Urban$n,
         Rural = Rural$n,
         Hospital = Hospital$n,
         Nonhospital = Nonhospital$n,
         Public = Public$n,
         Private = Private$n) |>
  relocate(Indicator, .before = Total)

Improved and on premises

Calculating improved and on premises indicator for each stratifier

Code
#calculating improved and on premises
GW12 <- data |>
  select(GW1, GW2, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gw12 <- GW12 |>
  filter(GW2 == "On premises") |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole") |>
  count(GW2) |>
  mutate(Total = (n / total_sample)*100) |>
  select(GW2, Total)

urban_gw12 <- GW12 |>
  filter(`urban/rural`== "Urban") |>
  filter(GW2 == "On premises") |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole") |>
  count(GW2) |>
  mutate(Urban = (n / total_urban)*100) |>
  select(GW2, Urban)

rural_gw12 <- GW12 |>
  filter(`urban/rural`== "Rural") |>
  filter(GW2 == "On premises") |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole") |>
  count(GW2) |>
  mutate(Rural = (n / total_rural)*100) |>
  select(GW2, Rural)

hospital_gw12 <- GW12 |>
  filter(`hospital/non-hospital`== "Hospital") |>
  filter(GW2 == "On premises") |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole") |>
  count(GW2) |>
  mutate(Hospital = (n / total_hospital)*100) |>
  select(GW2, Hospital)

nonhospital_gw12 <- GW12 |>
  filter(`hospital/non-hospital`== "Non-Hospital") |>
  filter(GW2 == "On premises") |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole") |>
  count(GW2) |>
  mutate(Nonhospital = (n / total_nonhospital)*100) |>
  select(GW2, Nonhospital)

public_gw12 <- GW12 |>
  filter(`public/private`== "Public") |>
  filter(GW2 == "On premises") |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole") |>
  count(GW2) |>
  mutate(Public = (n / total_public)*100) |>
  select(GW2, Public)

private_gw12 <- GW12 |>
  filter(`public/private`== "Private") |>
  filter(GW2 == "On premises") |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole") |>
  count(GW2) |>
  mutate(Private = (n / total_private)*100) |>
  select(GW2, Private)

# joining
improved_onpremises <- total_gw12 |>
  left_join(urban_gw12) |>
  left_join(rural_gw12) |>
  left_join(hospital_gw12) |>
  left_join(nonhospital_gw12) |>
  left_join(public_gw12) |>
  left_join(private_gw12) |>
  mutate(Indicator = "Improved and on premises",
         GW2 = NULL,
         Total =  Total$n,
         Urban = Urban$n,
         Rural = Rural$n,
         Hospital = Hospital$n,
         Nonhospital = Nonhospital$n,
         Public = Public$n,
         Private = Private$n) |>
  relocate(Indicator, .before = Total)

Basic and limited services

Calculating basic and limited service for each stratifier

Code
#calculating basic
GW123 <- data |>
  select(GW1, GW2, GW3, `urban/rural`, `hospital/non-hospital`, `public/private`)

basic_total <- GW123 |>
  filter(GW2 == "On premises") |>
  filter(GW3 == "Yes") |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole") |>
  count(GW2) |>
  mutate(Total = (n / total_sample)*100) |>
  select(GW2, Total)

basic_urban <- GW123 |>
  filter(`urban/rural`== "Urban") |>
  filter(GW2 == "On premises") |>
  filter(GW3 == "Yes") |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole") |>
  count(GW2) |>
  mutate(Urban = (n / total_urban)*100) |>
  select(GW2, Urban)

basic_rural <- GW123 |>
  filter(`urban/rural`== "Rural") |>
  filter(GW2 == "On premises") |>
  filter(GW3 == "Yes") |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole") |>
  count(GW2) |>
  mutate(Rural = (n / total_rural)*100) |>
  select(GW2, Rural)

basic_hospital <- GW123 |>
  filter(`hospital/non-hospital`== "Hospital") |>
  filter(GW2 == "On premises") |>
  filter(GW3 == "Yes") |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole") |>
  count(GW2) |>
  mutate(Hospital = (n / total_hospital)*100) |>
  select(GW2, Hospital)

basic_nonhospital <- GW123 |>
  filter(`hospital/non-hospital`== "Non-Hospital") |>
  filter(GW2 == "On premises") |>
  filter(GW3 == "Yes") |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole") |>
  count(GW2) |>
  mutate(Nonhospital = (n / total_nonhospital)*100) |>
  select(GW2, Nonhospital)

basic_public <- GW123 |>
  filter(`public/private`== "Public") |>
  filter(GW2 == "On premises") |>
  filter(GW3 == "Yes") |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole") |>
  count(GW2) |>
  mutate(Public = (n / total_public)*100) |>
  select(GW2, Public)

basic_private <- GW123 |>
  filter(`public/private`== "Private") |>
  filter(GW2 == "On premises") |>
  filter(GW3 == "Yes") |>
  filter(GW1 == "Piped Supply Outside the building" |
         GW1 == "Piped Supply inside the building" |
         GW1 == "Protected dug well" |
         GW1 == "Tanker truck" |
         GW1 == "Rainwater"    |
         GW1 == "Tube well/Borehole") |>
  count(GW2) |>
  mutate(Private = (n / total_private)*100) |>
  select(GW2, Private)

# joining
basic_water <- basic_total |>
  left_join(basic_urban) |>
  left_join(basic_rural) |>
  left_join(basic_hospital) |>
  left_join(basic_nonhospital) |>
  left_join(basic_public) |>
  left_join(basic_private) |>
  mutate(Indicator = "Basic",
         GW2 = NULL,
         Total =  Total$n,
         Urban = Urban$n,
         Rural = Rural$n,
         Hospital = Hospital$n,
         Nonhospital = Nonhospital$n,
         Public = Public$n,
         Private = Private$n) |>
  relocate(Indicator, .before = Total)

# calculating limited
limited_water <- tibble(
  Total = 100 - (basic_water[2] + no_service_water[2]),
  Urban = 100 - (basic_water[3] + no_service_water[3]),
  Rural = 100 - (basic_water[4] + no_service_water[4]),
  Hospital = 100 - (basic_water[5] + no_service_water[5]),
  Nonhospital = 100 - (basic_water[6] + no_service_water[6]),
  Public = 100 - (basic_water[7] + no_service_water[7]),
  Private = 100 - (basic_water[8] + no_service_water[8])) |>
  mutate(Indicator = "Limited",
         Total =  Total$Total,
         Urban = Urban$Urban,
         Rural = Rural$Rural,
         Hospital = Hospital$Hospital,
         Nonhospital = Nonhospital$Nonhospital,
         Public = Public$Public,
         Private = Private$Private) |>
  relocate(Indicator, .before = Total)

Sanitation Data

Improved facilities

Calculating improved sanitation facilities for each stratifier

Code
#calculating improved sanitation facility
GS1 <- data |>
  select(GS1, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gs1 <- GS1 |>
  count(GS1) |>
  mutate(Total = (n / sum(n))*100) |>
  select(GS1, Total)

urban_gs1 <- GS1 |>
  filter(`urban/rural`== "Urban") |>
  count(GS1) |>
  mutate(Urban = (n / sum(n))*100)|>
  select(GS1, Urban)

rural_gs1 <- GS1 |>
  filter(`urban/rural`== "Rural") |>
  count(GS1) |>
  mutate(Rural = (n / sum(n))*100)|>
  select(GS1, Rural)

hospital_gs1 <- GS1 |>
  filter(`hospital/non-hospital` == "Hospital") |>
  count(GS1) |>
  mutate(Hospital = (n / sum(n))*100)|>
  select(GS1, Hospital)

nonhospital_gs1 <- GS1 |>
  filter(`hospital/non-hospital` == "Non-Hospital") |>
  count(GS1) |>
  mutate(Nonhospital = (n / sum(n))*100)|>
  select(GS1, Nonhospital)

public_gs1 <- GS1 |>
  filter(`public/private` == "Public") |>
  count(GS1) |>
  mutate(Public = (n / sum(n))*100)|>
  select(GS1, Public)

private_gs1 <- GS1 |>
  filter(`public/private` == "Private") |>
  count(GS1) |>
  mutate(Private = (n / sum(n))*100)|>
  select(GS1, Private)

# joining
san_fac <- total_gs1 |>
  left_join(urban_gs1) |>
  left_join(rural_gs1) |>
  left_join(hospital_gs1) |>
  left_join(nonhospital_gs1) |>
  left_join(public_gs1) |>
  left_join(private_gs1)

# replacing NA with zero
san_fac <- san_fac |>
  replace(is.na(san_fac), 0)

# calculate improved
improved_san_fac <- san_fac |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  summarise_at(vars(Total, Urban, Rural, Hospital, Nonhospital, Public, Private), sum)|>
  mutate(Indicator = "Improved sanitation facility") |>
  relocate(Indicator, .before = Total)

# calculate no service
no_service_san <- san_fac |>
  filter(GS1 == "Pit latrine without slab" |
         GS1 == "other") |>
  summarise_at(vars(Total, Urban, Rural, Hospital, Nonhospital, Public, Private), sum) |>
  mutate(Indicator = "No service") |>
  relocate(Indicator, .before = Total)

Usable facilities

Calculating usable sanitation facilities for each stratifier

Code
#calculate usable facilities
GS2 <- data |>
  select(GS2, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gs2 <- GS2 |>
  count(GS2) |>
  mutate(Total = (n / sum(n))*100) |>
  select(GS2, Total) |>
  filter(GS2 == "Yes")

urban_gs2 <- GS2 |>
  filter(`urban/rural`== "Urban") |>
  count(GS2) |>
  mutate(Urban = (n / sum(n))*100)|>
  select(GS2, Urban) |>
  filter(GS2 == "Yes")

rural_gs2 <- GS2 |>
  filter(`urban/rural`== "Rural") |>
  count(GS2) |>
  mutate(Rural = (n / sum(n))*100)|>
  select(GS2, Rural)|>
  filter(GS2 == "Yes")

hospital_gs2 <- GS2 |>
  filter(`hospital/non-hospital` == "Hospital") |>
  count(GS2) |>
  mutate(Hospital = (n / sum(n))*100)|>
  select(GS2, Hospital)|>
  filter(GS2 == "Yes")

nonhospital_gs2 <- GS2 |>
  filter(`hospital/non-hospital` == "Non-Hospital") |>
  count(GS2) |>
  mutate(Nonhospital = (n / sum(n))*100)|>
  select(GS2, Nonhospital)|>
  filter(GS2 == "Yes")

public_gs2 <- GS2 |>
  filter(`public/private` == "Public") |>
  count(GS2) |>
  mutate(Public = (n / sum(n))*100)|>
  select(GS2, Public)|>
  filter(GS2 == "Yes")

private_gs2 <- GS2 |>
  filter(`public/private` == "Private") |>
  count(GS2) |>
  mutate(Private = (n / sum(n))*100)|>
  select(GS2, Private)|>
  filter(GS2 == "Yes")

# joining
san_usable <- total_gs2 |>
  left_join(urban_gs2) |>
  left_join(rural_gs2) |>
  left_join(hospital_gs2) |>
  left_join(nonhospital_gs2) |>
  left_join(public_gs2) |>
  left_join(private_gs2) |>
  mutate(Indicator = "Usable sanitation facility",
         GS2 = NULL) |>
  relocate(Indicator, .before = Total)

Facilities dedicated to staff

Calculating facilities dedicated for staff for each stratifier

Code
# calculate facilities dedicated for staff
GS3 <- data |>
  select(GS3, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gs3 <- GS3 |>
  count(GS3) |>
  mutate(Total = (n / sum(n))*100) |>
  select(GS3, Total) |>
  filter(GS3 == "Yes")

urban_gs3 <- GS3 |>
  filter(`urban/rural`== "Urban") |>
  count(GS3) |>
  mutate(Urban = (n / sum(n))*100)|>
  select(GS3, Urban) |>
  filter(GS3 == "Yes")

rural_gs3 <- GS3 |>
  filter(`urban/rural`== "Rural") |>
  count(GS3) |>
  mutate(Rural = (n / sum(n))*100)|>
  select(GS3, Rural)|>
  filter(GS3 == "Yes")

hospital_gs3 <- GS3 |>
  filter(`hospital/non-hospital` == "Hospital") |>
  count(GS3) |>
  mutate(Hospital = (n / sum(n))*100)|>
  select(GS3, Hospital)|>
  filter(GS3 == "Yes")

nonhospital_gs3 <- GS3 |>
  filter(`hospital/non-hospital` == "Non-Hospital") |>
  count(GS3) |>
  mutate(Nonhospital = (n / sum(n))*100)|>
  select(GS3, Nonhospital)|>
  filter(GS3 == "Yes")

public_gs3 <- GS3 |>
  filter(`public/private` == "Public") |>
  count(GS3) |>
  mutate(Public = (n / sum(n))*100)|>
  select(GS3, Public)|>
  filter(GS3 == "Yes")

private_gs3 <- GS3 |>
  filter(`public/private` == "Private") |>
  count(GS3) |>
  mutate(Private = (n / sum(n))*100)|>
  select(GS3, Private)|>
  filter(GS3 == "Yes")

# joining
san_staff <- total_gs3 |>
  left_join(urban_gs3) |>
  left_join(rural_gs3) |>
  left_join(hospital_gs3) |>
  left_join(nonhospital_gs3) |>
  left_join(public_gs3) |>
  left_join(private_gs3) |>
  mutate(Indicator = "Dedicated to staff",
         GS3 = NULL) |>
  relocate(Indicator, .before = Total)

Sex-separated facilities

Calculating sex-separated facilities for each stratifier

Code
# calculate sex-separated facilities
GS4 <- data |>
  select(GS4, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gs4 <- GS4 |>
  count(GS4) |>
  mutate(Total = (n / sum(n))*100) |>
  select(GS4, Total) |>
  filter(GS4 == "Yes")

urban_gs4 <- GS4 |>
  filter(`urban/rural`== "Urban") |>
  count(GS4) |>
  mutate(Urban = (n / sum(n))*100)|>
  select(GS4, Urban) |>
  filter(GS4 == "Yes")

rural_gs4 <- GS4 |>
  filter(`urban/rural`== "Rural") |>
  count(GS4) |>
  mutate(Rural = (n / sum(n))*100)|>
  select(GS4, Rural)|>
  filter(GS4 == "Yes")

hospital_gs4 <- GS4 |>
  filter(`hospital/non-hospital` == "Hospital") |>
  count(GS4) |>
  mutate(Hospital = (n / sum(n))*100)|>
  select(GS4, Hospital)|>
  filter(GS4 == "Yes")

nonhospital_gs4 <- GS4 |>
  filter(`hospital/non-hospital` == "Non-Hospital") |>
  count(GS4) |>
  mutate(Nonhospital = (n / sum(n))*100)|>
  select(GS4, Nonhospital)|>
  filter(GS4 == "Yes")

public_gs4 <- GS4 |>
  filter(`public/private` == "Public") |>
  count(GS4) |>
  mutate(Public = (n / sum(n))*100)|>
  select(GS4, Public)|>
  filter(GS4 == "Yes")

private_gs4 <- GS4 |>
  filter(`public/private` == "Private") |>
  count(GS4) |>
  mutate(Private = (n / sum(n))*100)|>
  select(GS4, Private)|>
  filter(GS4 == "Yes")

# joining
san_sex <- total_gs4 |>
  left_join(urban_gs4) |>
  left_join(rural_gs4) |>
  left_join(hospital_gs4) |>
  left_join(nonhospital_gs4) |>
  left_join(public_gs4) |>
  left_join(private_gs4) |>
  mutate(Indicator = "Sex-separated facility",
         GS4 = NULL) |>
  relocate(Indicator, .before = Total)

Menstrual hygiene facilities

Calculating menstrual hygiene facilities for each stratifier

Code
# calculate menstrual hygiene facilities
GS5 <- data |>
  select(GS5, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gs5 <- GS5 |>
  count(GS5) |>
  mutate(Total = (n / sum(n))*100) |>
  select(GS5, Total) |>
  filter(GS5 == "Yes")

urban_gs5 <- GS5 |>
  filter(`urban/rural`== "Urban") |>
  count(GS5) |>
  mutate(Urban = (n / sum(n))*100)|>
  select(GS5, Urban) |>
  filter(GS5 == "Yes")

rural_gs5 <- GS5 |>
  filter(`urban/rural`== "Rural") |>
  count(GS5) |>
  mutate(Rural = (n / sum(n))*100)|>
  select(GS5, Rural)|>
  filter(GS5 == "Yes")

hospital_gs5 <- GS5 |>
  filter(`hospital/non-hospital` == "Hospital") |>
  count(GS5) |>
  mutate(Hospital = (n / sum(n))*100)|>
  select(GS5, Hospital)|>
  filter(GS5 == "Yes")

nonhospital_gs5 <- GS5 |>
  filter(`hospital/non-hospital` == "Non-Hospital") |>
  count(GS5) |>
  mutate(Nonhospital = (n / sum(n))*100)|>
  select(GS5, Nonhospital)|>
  filter(GS5 == "Yes")

public_gs5 <- GS5 |>
  filter(`public/private` == "Public") |>
  count(GS5) |>
  mutate(Public = (n / sum(n))*100)|>
  select(GS5, Public)|>
  filter(GS5 == "Yes")

private_gs5 <- GS5 |>
  filter(`public/private` == "Private") |>
  count(GS5) |>
  mutate(Private = (n / sum(n))*100)|>
  select(GS5, Private)|>
  filter(GS5 == "Yes")

# joining
san_mhm <- total_gs5 |>
  left_join(urban_gs5) |>
  left_join(rural_gs5) |>
  left_join(hospital_gs5) |>
  left_join(nonhospital_gs5) |>
  left_join(public_gs5) |>
  left_join(private_gs5) |>
  mutate(Indicator = "Menstrual hygiene faciliy",
         GS5 = NULL) |>
  relocate(Indicator, .before = Total)

Accessible for limited mobility

Calculating facilities accessible for limited mobility for each stratifier

Code
# calculate facilities accessible for limited mobility
GS6 <- data |>
  select(GS6, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gs6 <- GS6 |>
  count(GS6) |>
  mutate(Total = (n / sum(n))*100) |>
  select(GS6, Total) |>
  filter(GS6 == "yes")

urban_gs6 <- GS6 |>
  filter(`urban/rural`== "Urban") |>
  count(GS6) |>
  mutate(Urban = (n / sum(n))*100)|>
  select(GS6, Urban) |>
  filter(GS6 == "yes")

rural_gs6 <- GS6 |>
  filter(`urban/rural`== "Rural") |>
  count(GS6) |>
  mutate(Rural = (n / sum(n))*100)|>
  select(GS6, Rural)|>
  filter(GS6 == "yes")

hospital_gs6 <- GS6 |>
  filter(`hospital/non-hospital` == "Hospital") |>
  count(GS6) |>
  mutate(Hospital = (n / sum(n))*100)|>
  select(GS6, Hospital)|>
  filter(GS6 == "yes")

nonhospital_gs6 <- GS6 |>
  filter(`hospital/non-hospital` == "Non-Hospital") |>
  count(GS6) |>
  mutate(Nonhospital = (n / sum(n))*100)|>
  select(GS6, Nonhospital)|>
  filter(GS6 == "yes")

public_gs6 <- GS6 |>
  filter(`public/private` == "Public") |>
  count(GS6) |>
  mutate(Public = (n / sum(n))*100)|>
  select(GS6, Public)|>
  filter(GS6 == "yes")

private_gs6 <- GS6 |>
  filter(`public/private` == "Private") |>
  count(GS6) |>
  mutate(Private = (n / sum(n))*100)|>
  select(GS6, Private)|>
  filter(GS6 == "yes")

# joining
san_mobility <- total_gs6 |>
  left_join(urban_gs6) |>
  left_join(rural_gs6) |>
  left_join(hospital_gs6) |>
  left_join(nonhospital_gs6) |>
  left_join(public_gs6) |>
  left_join(private_gs6) |>
  mutate(Indicator = "Accessible for limited mobility",
         GS6 = NULL) |>
  relocate(Indicator, .before = Total)

Improved and usable

Calculating improved and usable indicator for each stratifier

Code
#calculating improved and usable
GS12 <- data |>
  select(GS1, GS2, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gs12 <- GS12 |>
  filter(GS2 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS2) |>
  mutate(Total = (n / total_sample)*100) |>
  select(GS2, Total)

urban_gs12 <- GS12 |>
  filter(`urban/rural`== "Urban") |>
  filter(GS2 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS2) |>
  mutate(Urban = (n / total_urban)*100) |>
  select(GS2, Urban)

rural_gs12 <- GS12 |>
  filter(`urban/rural`== "Rural") |>
  filter(GS2 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS2) |>
  mutate(Rural = (n / total_rural)*100) |>
  select(GS2, Rural)

hospital_gs12 <- GS12 |>
  filter(`hospital/non-hospital`== "Hospital") |>
  filter(GS2 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS2) |>
  mutate(Hospital = (n / total_hospital)*100) |>
  select(GS2, Hospital)

nonhospital_gs12 <- GS12 |>
  filter(`hospital/non-hospital`== "Non-Hospital") |>
  filter(GS2 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS2) |>
  mutate(Nonhospital = (n / total_nonhospital)*100) |>
  select(GS2, Nonhospital)

public_gs12 <- GS12 |>
  filter(`public/private`== "Public") |>
  filter(GS2 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS2) |>
  mutate(Public = (n / total_public)*100) |>
  select(GS2, Public)

private_gs12 <- GS12 |>
  filter(`public/private`== "Private") |>
  filter(GS2 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS2) |>
  mutate(Private = (n / total_private)*100) |>
  select(GS2, Private)

# joining
improved_usable <- total_gs12 |>
  left_join(urban_gs12) |>
  left_join(rural_gs12) |>
  left_join(hospital_gs12) |>
  left_join(nonhospital_gs12) |>
  left_join(public_gs12) |>
  left_join(private_gs12) |>
  mutate(Indicator = "Improved and usable",
         GS2 = NULL,
         Total =  Total$n,
         Urban = Urban$n,
         Rural = Rural$n,
         Hospital = Hospital$n,
         Nonhospital = Nonhospital$n,
         Public = Public$n,
         Private = Private$n) |>
  relocate(Indicator, .before = Total)

Improved and staff

Calculating improved and staff indicator for each stratifier

Code
#calculating improved and staff
GS13 <- data |>
  select(GS1, GS3, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gs13 <- GS13 |>
  filter(GS3 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS3) |>
  mutate(Total = (n / total_sample)*100) |>
  select(GS3, Total)

urban_gs13 <- GS13 |>
  filter(`urban/rural`== "Urban") |>
  filter(GS3 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS3) |>
  mutate(Urban = (n / total_urban)*100) |>
  select(GS3, Urban)

rural_gs13 <- GS13 |>
  filter(`urban/rural`== "Rural") |>
  filter(GS3 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS3) |>
  mutate(Rural = (n / total_rural)*100) |>
  select(GS3, Rural)

hospital_gs13 <- GS13 |>
  filter(`hospital/non-hospital`== "Hospital") |>
  filter(GS3 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS3) |>
  mutate(Hospital = (n / total_hospital)*100) |>
  select(GS3, Hospital)

nonhospital_gs13 <- GS13 |>
  filter(`hospital/non-hospital`== "Non-Hospital") |>
  filter(GS3 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS3) |>
  mutate(Nonhospital = (n / total_nonhospital)*100) |>
  select(GS3, Nonhospital)

public_gs13 <- GS13 |>
  filter(`public/private`== "Public") |>
  filter(GS3 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS3) |>
  mutate(Public = (n / total_public)*100) |>
  select(GS3, Public)

private_gs13 <- GS13 |>
  filter(`public/private`== "Private") |>
  filter(GS3 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS3) |>
  mutate(Private = (n / total_private)*100) |>
  select(GS3, Private)

# joining
improved_staff <- total_gs13 |>
  left_join(urban_gs13) |>
  left_join(rural_gs13) |>
  left_join(hospital_gs13) |>
  left_join(nonhospital_gs13) |>
  left_join(public_gs13) |>
  left_join(private_gs13) |>
  mutate(Indicator = "Improved and staff",
         GS3 = NULL,
         Total =  Total$n,
         Urban = Urban$n,
         Rural = Rural$n,
         Hospital = Hospital$n,
         Nonhospital = Nonhospital$n,
         Public = Public$n,
         Private = Private$n) |>
  relocate(Indicator, .before = Total)

Improved and sex-separated

Calculating improved and sex-separated indicator for each stratifier

Code
#calculating improved and sex-separated
GS14 <- data |>
  select(GS1, GS4, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gs14 <- GS14 |>
  filter(GS4 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS4) |>
  mutate(Total = (n / total_sample)*100) |>
  select(GS4, Total)

urban_gs14 <- GS14 |>
  filter(`urban/rural`== "Urban") |>
  filter(GS4 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS4) |>
  mutate(Urban = (n / total_urban)*100) |>
  select(GS4, Urban)

rural_gs14 <- GS14 |>
  filter(`urban/rural`== "Rural") |>
  filter(GS4 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS4) |>
  mutate(Rural = (n / total_rural)*100) |>
  select(GS4, Rural)

hospital_gs14 <- GS14 |>
  filter(`hospital/non-hospital`== "Hospital") |>
  filter(GS4 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS4) |>
  mutate(Hospital = (n / total_hospital)*100) |>
  select(GS4, Hospital)

nonhospital_gs14 <- GS14 |>
  filter(`hospital/non-hospital`== "Non-Hospital") |>
  filter(GS4 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS4) |>
  mutate(Nonhospital = (n / total_nonhospital)*100) |>
  select(GS4, Nonhospital)

public_gs14 <- GS14 |>
  filter(`public/private`== "Public") |>
  filter(GS4 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS4) |>
  mutate(Public = (n / total_public)*100) |>
  select(GS4, Public)

private_gs14 <- GS14 |>
  filter(`public/private`== "Private") |>
  filter(GS4 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS4) |>
  mutate(Private = (n / total_private)*100) |>
  select(GS4, Private)

# joining
improved_sex <- total_gs14 |>
  left_join(urban_gs14) |>
  left_join(rural_gs14) |>
  left_join(hospital_gs14) |>
  left_join(nonhospital_gs14) |>
  left_join(public_gs14) |>
  left_join(private_gs14) |>
  mutate(Indicator = "Improved and sex-separated",
         GS4 = NULL,
         Total =  Total$n,
         Urban = Urban$n,
         Rural = Rural$n,
         Hospital = Hospital$n,
         Nonhospital = Nonhospital$n,
         Public = Public$n,
         Private = Private$n) |>
  relocate(Indicator, .before = Total)

Improved and menstrual hygiene

Calculating improved and menstrual hygiene indicator for each stratifier

Code
#calculating improved and menstrual hygiene
GS15 <- data |>
  select(GS1, GS5, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gs15 <- GS15 |>
  filter(GS5 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS5) |>
  mutate(Total = (n / total_sample)*100) |>
  select(GS5, Total)

urban_gs15 <- GS15 |>
  filter(`urban/rural`== "Urban") |>
  filter(GS5 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS5) |>
  mutate(Urban = (n / total_urban)*100) |>
  select(GS5, Urban)

rural_gs15 <- GS15 |>
  filter(`urban/rural`== "Rural") |>
  filter(GS5 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS5) |>
  mutate(Rural = (n / total_rural)*100) |>
  select(GS5, Rural)

hospital_gs15 <- GS15 |>
  filter(`hospital/non-hospital`== "Hospital") |>
  filter(GS5 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS5) |>
  mutate(Hospital = (n / total_hospital)*100) |>
  select(GS5, Hospital)

nonhospital_gs15 <- GS15 |>
  filter(`hospital/non-hospital`== "Non-Hospital") |>
  filter(GS5 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS5) |>
  mutate(Nonhospital = (n / total_nonhospital)*100) |>
  select(GS5, Nonhospital)

public_gs15 <- GS15 |>
  filter(`public/private`== "Public") |>
  filter(GS5 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS5) |>
  mutate(Public = (n / total_public)*100) |>
  select(GS5, Public)

private_gs15 <- GS15 |>
  filter(`public/private`== "Private") |>
  filter(GS5 == "Yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS5) |>
  mutate(Private = (n / total_private)*100) |>
  select(GS5, Private)

# joining
improved_mhm <- total_gs15 |>
  left_join(urban_gs15) |>
  left_join(rural_gs15) |>
  left_join(hospital_gs15) |>
  left_join(nonhospital_gs15) |>
  left_join(public_gs15) |>
  left_join(private_gs15) |>
  mutate(Indicator = "Improved and menstrual hygiene",
         GS5 = NULL,
         Total =  Total$n,
         Urban = Urban$n,
         Rural = Rural$n,
         Hospital = Hospital$n,
         Nonhospital = Nonhospital$n,
         Public = Public$n,
         Private = Private$n) |>
  relocate(Indicator, .before = Total)

Improved and limited mobility

Calculating improved and limited mobility indicator for each stratifier

Code
#calculating improved and limited mobility
GS16 <- data |>
  select(GS1, GS6, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gs16 <- GS16 |>
  filter(GS6 == "yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS6) |>
  mutate(Total = (n / total_sample)*100) |>
  select(GS6, Total)

urban_gs16 <- GS16 |>
  filter(`urban/rural`== "Urban") |>
  filter(GS6 == "yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS6) |>
  mutate(Urban = (n / total_urban)*100) |>
  select(GS6, Urban)

rural_gs16 <- GS16 |>
  filter(`urban/rural`== "Rural") |>
  filter(GS6 == "yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS6) |>
  mutate(Rural = (n / total_rural)*100) |>
  select(GS6, Rural)

hospital_gs16 <- GS16 |>
  filter(`hospital/non-hospital`== "Hospital") |>
  filter(GS6 == "yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS6) |>
  mutate(Hospital = (n / total_hospital)*100) |>
  select(GS6, Hospital)

nonhospital_gs16 <- GS16 |>
  filter(`hospital/non-hospital`== "Non-Hospital") |>
  filter(GS6 == "yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS6) |>
  mutate(Nonhospital = (n / total_nonhospital)*100) |>
  select(GS6, Nonhospital)

public_gs16 <- GS16 |>
  filter(`public/private`== "Public") |>
  filter(GS6 == "yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS6) |>
  mutate(Public = (n / total_public)*100) |>
  select(GS6, Public)

private_gs16 <- GS16 |>
  filter(`public/private`== "Private") |>
  filter(GS6 == "yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS6) |>
  mutate(Private = (n / total_private)*100) |>
  select(GS6, Private)

# joining
improved_mobility <- total_gs16 |>
  left_join(urban_gs16) |>
  left_join(rural_gs16) |>
  left_join(hospital_gs16) |>
  left_join(nonhospital_gs16) |>
  left_join(public_gs16) |>
  left_join(private_gs16) |>
  mutate(Indicator = "Improved and limited mobility",
         GS6 = NULL,
         Total =  Total$n,
         Urban = Urban$n,
         Rural = Rural$n,
         Hospital = Hospital$n,
         Nonhospital = Nonhospital$n,
         Public = Public$n,
         Private = Private$n) |>
  relocate(Indicator, .before = Total)

Basic and limited services

Calculating basic and limited service for each stratifier

Code
# calculating basic
GS <- data |>
  select(GS1, GS2, GS3, GS4, GS5, GS6, `urban/rural`, `hospital/non-hospital`, `public/private`)

basic_total <- GS |>
  filter(GS2 == "Yes") |>
  filter(GS3 == "Yes") |>
  filter(GS4 == "Yes") |>
  filter(GS5 == "Yes") |>
  filter(GS6 == "yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS2) |>
  mutate(Total = (n / total_sample)*100) |>
  select(GS2, Total)

basic_urban <- GS |>
  filter(`urban/rural`== "Urban") |>
  filter(GS2 == "Yes") |>
  filter(GS3 == "Yes") |>
  filter(GS4 == "Yes") |>
  filter(GS5 == "Yes") |>
  filter(GS6 == "yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS2) |>
  mutate(Urban = (n / total_urban)*100) |>
  select(GS2, Urban)

basic_rural <- GS |>
  filter(`urban/rural`== "Rural") |>
  filter(GS2 == "Yes") |>
  filter(GS3 == "Yes") |>
  filter(GS4 == "Yes") |>
  filter(GS5 == "Yes") |>
  filter(GS6 == "yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS2) |>
  mutate(Rural = (n / total_rural)*100) |>
  select(GS2, Rural)

basic_hospital <- GS |>
  filter(`hospital/non-hospital`== "Hospital") |>
  filter(GS2 == "Yes") |>
  filter(GS3 == "Yes") |>
  filter(GS4 == "Yes") |>
  filter(GS5 == "Yes") |>
  filter(GS6 == "yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS2) |>
  mutate(Hospital = (n / total_hospital)*100) |>
  select(GS2, Hospital)

basic_nonhospital <- GS |>
  filter(`hospital/non-hospital`== "Non-Hospital") |>
  filter(GS2 == "Yes") |>
  filter(GS3 == "Yes") |>
  filter(GS4 == "Yes") |>
  filter(GS5 == "Yes") |>
  filter(GS6 == "yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS2) |>
  mutate(Nonhospital = (n / total_nonhospital)*100) |>
  select(GS2, Nonhospital)

basic_public <- GS |>
  filter(`public/private`== "Public") |>
  filter(GS2 == "Yes") |>
  filter(GS3 == "Yes") |>
  filter(GS4 == "Yes") |>
  filter(GS5 == "Yes") |>
  filter(GS6 == "yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS2) |>
  mutate(Public = (n / total_public)*100) |>
  select(GS2, Public)

basic_private <- GS |>
  filter(`public/private`== "Private") |>
  filter(GS2 == "Yes") |>
  filter(GS3 == "Yes") |>
  filter(GS4 == "Yes") |>
  filter(GS5 == "Yes") |>
  filter(GS6 == "yes") |>
  filter(GS1 == "Flush/Pour-flush toilet to tank or pit" |
         GS1 == "Pit latrine with slab" |
         GS1 == "pit latrine with slab") |>
  count(GS2) |>
  mutate(Private = (n / total_private)*100) |>
  select(GS2, Private)

# joining
basic_san <- basic_total |>
  left_join(basic_urban) |>
  left_join(basic_rural) |>
  left_join(basic_hospital) |>
  left_join(basic_nonhospital) |>
  left_join(basic_public) |>
  left_join(basic_private) |>
  mutate(Indicator = "Basic",
         GS2 = NULL,
         Total =  Total$n,
         Urban = Urban$n,
         Rural = Rural$n,
         Hospital = Hospital$n,
         Nonhospital = Nonhospital$n,
         Public = Public$n,
         Private = Private$n) |>
  relocate(Indicator, .before = Total)

# calculating limited
limited_san <- tibble(
  Total = 100 - (basic_san[2] + no_service_san[2]),
  Urban = 100 - (basic_san[3] + no_service_san[3]),
  Rural = 100 - (basic_san[4] + no_service_san[4]),
  Hospital = 100 - (basic_san[5] + no_service_san[5]),
  Nonhospital = 100 - (basic_san[6] + no_service_san[6]),
  Public = 100 - (basic_san[7] + no_service_san[7]),
  Private = 100 - (basic_san[8] + no_service_san[8])) |>
  mutate(Indicator = "Limited",
         Total =  Total$Total,
         Urban = Urban$Urban,
         Rural = Rural$Rural,
         Hospital = Hospital$Hospital,
         Nonhospital = Nonhospital$Nonhospital,
         Public = Public$Public,
         Private = Private$Private) |>
  relocate(Indicator, .before = Total)

Hygiene Data

Points of care

Calculating handwashing facilities with water and soap at points of care for each stratifier

Code
# calculating handwashing facilities with water and soap at points of care
GH1 <- data |>
  select(GH1, `urban/rural`, `hospital/non-hospital`, `public/private`) |>
  filter(GH1 == "Yes")

total_gh1 <- GH1 |>
  count(GH1) |>
  mutate(Total = (n / total_sample)*100) |>
  select(GH1, Total)

urban_gh1 <- GH1 |>
  filter(`urban/rural`== "Urban") |>
  count(GH1) |>
  mutate(Urban = (n / total_urban)*100)|>
  select(GH1, Urban)

rural_gh1 <- GH1 |>
  filter(`urban/rural`== "Rural") |>
  count(GH1) |>
  mutate(Rural = (n / total_rural)*100)|>
  select(GH1, Rural)

hospital_gh1 <- GH1 |>
  filter(`hospital/non-hospital` == "Hospital") |>
  count(GH1) |>
  mutate(Hospital = (n / total_hospital)*100)|>
  select(GH1, Hospital)

nonhospital_gh1 <- GH1 |>
  filter(`hospital/non-hospital` == "Non-Hospital") |>
  count(GH1) |>
  mutate(Nonhospital = (n / total_nonhospital)*100)|>
  select(GH1, Nonhospital)

public_gh1 <- GH1 |>
  filter(`public/private` == "Public") |>
  count(GH1) |>
  mutate(Public = (n / total_public)*100)|>
  select(GH1, Public)

private_gh1 <- GH1 |>
  filter(`public/private` == "Private") |>
  count(GH1) |>
  mutate(Private = (n / total_private)*100)|>
  select(GH1, Private)

# joining and replace NA with zero 
pointsofcare <- total_gh1 |>
  left_join(urban_gh1) |>
  left_join(rural_gh1) |>
  left_join(hospital_gh1) |>
  left_join(nonhospital_gh1) |>
  left_join(public_gh1) |>
  left_join(private_gh1) |>
  mutate(Indicator = "Handwashing facilities with water and soap at points of care",
         GH1 = NULL,
         Total =  Total$n,
         Urban = Urban$n,
         Rural = Rural$n,
         Hospital = Hospital$n,
         Nonhospital = Nonhospital$n,
         Public = Public$n,
         Private = Private$n) |>
  relocate(Indicator, .before = Total)

Toilets

Calculating handwashing facilities within 5 meters of toilets for each stratifier

Code
# calculating handwashing facilities within 5 metres of toilets
GH2 <- data |>
  select(GH2, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gh2 <- GH2 |>
  filter(GH2 == "Yes" |
         GH2 == "No, there are handwashing facilities near the toilets but lacking soap and /or water") |>
  count(GH2) |>
  summarise_at(vars(n), sum) |>
  mutate(GH2 = "Yes",
         Total = (n / total_sample) * 100,
         n = NULL)

urban_gh2 <- GH2 |>
  filter(`urban/rural`== "Urban",
         GH2 == "Yes" |
         GH2 == "No, there are handwashing facilities near the toilets but lacking soap and /or water") |>
  count(GH2) |>
  summarise_at(vars(n), sum) |>
  mutate(GH2 = "Yes",
         Urban = (n / total_urban) * 100,
         n = NULL)

rural_gh2 <- GH2 |>
  filter(`urban/rural`== "Rural",
         GH2 == "Yes" |
         GH2 == "No, there are handwashing facilities near the toilets but lacking soap and /or water") |>
  count(GH2) |>
  summarise_at(vars(n), sum) |>
  mutate(GH2 = "Yes",
         Rural = (n / total_rural) * 100,
         n = NULL)

hospital_gh2 <- GH2 |>
  filter(`hospital/non-hospital` == "Hospital",
         GH2 == "Yes" |
         GH2 == "No, there are handwashing facilities near the toilets but lacking soap and /or water") |>
  count(GH2) |>
  summarise_at(vars(n), sum) |>
  mutate(GH2 = "Yes",
         Hospital = (n / total_hospital) * 100,
         n = NULL)

nonhospital_gh2 <- GH2 |>
  filter(`hospital/non-hospital` == "Non-Hospital",
         GH2 == "Yes" |
         GH2 == "No, there are handwashing facilities near the toilets but lacking soap and /or water") |>
  count(GH2) |>
  summarise_at(vars(n), sum) |>
  mutate(GH2 = "Yes",
         Nonhospital = (n / total_nonhospital) * 100,
         n = NULL)

public_gh2 <- GH2 |>
  filter(`public/private` == "Public",
         GH2 == "Yes" |
         GH2 == "No, there are handwashing facilities near the toilets but lacking soap and /or water") |>
  count(GH2) |>
  summarise_at(vars(n), sum) |>
  mutate(GH2 = "Yes",
         Public = (n / total_public) * 100,
         n = NULL)

private_gh2 <- GH2 |>
  filter(`public/private` == "Private",
         GH2 == "Yes" |
         GH2 == "No, there are handwashing facilities near the toilets but lacking soap and /or water") |>
  count(GH2) |>
  summarise_at(vars(n), sum) |>
  mutate(GH2 = "Yes",
         Private = (n / total_private) * 100,
         n = NULL)

# joining
toilets <- total_gh2 |>
  left_join(urban_gh2) |>
  left_join(rural_gh2) |>
  left_join(hospital_gh2) |>
  left_join(nonhospital_gh2) |>
  left_join(public_gh2) |>
  left_join(private_gh2) |>
  mutate(Indicator = "Handwashing facilities within 5 metres of toilets",
         GH2 = NULL,
         Total =  Total$n,
         Urban = Urban$n,
         Rural = Rural$n,
         Hospital = Hospital$n,
         Nonhospital = Nonhospital$n,
         Public = Public$n,
         Private = Private$n) |>
  relocate(Indicator, .before = Total)

# calculating handwashing facilities within 5 metres of toilets with water and soap
GH2_fun <- data |>
  select(GH2, `urban/rural`, `hospital/non-hospital`, `public/private`) |>
  filter(GH2 == "Yes")

total_gh2_fun <- GH2_fun |>
  count(GH2) |>
  mutate(Total = (n / total_sample)*100) |>
  select(GH2, Total)

urban_gh2_fun <- GH2_fun |>
  filter(`urban/rural`== "Urban") |>
  count(GH2) |>
  mutate(Urban = (n / total_urban)*100)|>
  select(GH2, Urban)

rural_gh2_fun <- GH2_fun |>
  filter(`urban/rural`== "Rural") |>
  count(GH2) |>
  mutate(Rural = (n / total_rural)*100)|>
  select(GH2, Rural)

hospital_gh2_fun <- GH2_fun |>
  filter(`hospital/non-hospital` == "Hospital") |>
  count(GH2) |>
  mutate(Hospital = (n / total_hospital)*100)|>
  select(GH2, Hospital)

nonhospital_gh2_fun <- GH2_fun |>
  filter(`hospital/non-hospital` == "Non-Hospital") |>
  count(GH2) |>
  mutate(Nonhospital = (n / total_nonhospital)*100)|>
  select(GH2, Nonhospital)

public_gh2_fun <- GH2_fun |>
  filter(`public/private` == "Public") |>
  count(GH2) |>
  mutate(Public = (n / total_public)*100)|>
  select(GH2, Public)

private_gh2_fun <- GH2_fun |>
  filter(`public/private` == "Private") |>
  count(GH2) |>
  mutate(Private = (n / total_private)*100)|>
  select(GH2, Private)

# joining
toilets_fun <- total_gh2_fun |>
  left_join(urban_gh2_fun) |>
  left_join(rural_gh2_fun) |>
  left_join(hospital_gh2_fun) |>
  left_join(nonhospital_gh2_fun) |>
  left_join(public_gh2_fun) |>
  left_join(private_gh2_fun) |>
  mutate(Indicator = "Handwashing facilities within 5 metres of toilets with water and soap",
         GH2 = NULL,
         Total =  Total$n,
         Urban = Urban$n,
         Rural = Rural$n,
         Hospital = Hospital$n,
         Nonhospital = Nonhospital$n,
         Public = Public$n,
         Private = Private$n) |>
  relocate(Indicator, .before = Total)

Basic and limited services

Calculating basic and limited service for each stratifier

Code
# calculating basic
GH12 <- data |>
  select(GH1, GH2, `urban/rural`, `hospital/non-hospital`, `public/private`) |>
  filter(GH1 == "Yes" &
         GH2 == "Yes")

total_gh12 <- GH12 |>
  count(GH2) |>
  mutate(Total = (n / total_sample)*100) |>
  select(GH2, Total)

urban_gh12 <- GH12 |>
  filter(`urban/rural`== "Urban") |>
  count(GH2) |>
  mutate(Urban = (n / total_urban)*100)|>
  select(GH2, Urban)

rural_gh12 <- GH12 |>
  filter(`urban/rural`== "Rural") |>
  count(GH2) |>
  mutate(Rural = (n / total_rural)*100)|>
  select(GH2, Rural)

hospital_gh12 <- GH12 |>
  filter(`hospital/non-hospital` == "Hospital") |>
  count(GH2) |>
  mutate(Hospital = (n / total_hospital)*100)|>
  select(GH2, Hospital)

nonhospital_gh12 <- GH12 |>
  filter(`hospital/non-hospital` == "Non-Hospital") |>
  count(GH2) |>
  mutate(Nonhospital = (n / total_nonhospital)*100)|>
  select(GH2, Nonhospital)

public_gh12 <- GH12 |>
  filter(`public/private` == "Public") |>
  count(GH2) |>
  mutate(Public = (n / total_public)*100)|>
  select(GH2, Public)

private_gh12 <- GH12 |>
  filter(`public/private` == "Private") |>
  count(GH2) |>
  mutate(Private = (n / total_private)*100)|>
  select(GH2, Private)

# joining
basic_hygiene <- total_gh12 |>
  left_join(urban_gh12) |>
  left_join(rural_gh12) |>
  left_join(hospital_gh12) |>
  left_join(nonhospital_gh12) |>
  left_join(public_gh12) |>
  left_join(private_gh12) |>
  mutate(Indicator = "Basic",
         GH2 = NULL,
         Total =  Total$n,
         Urban = Urban$n,
         Rural = Rural$n,
         Hospital = Hospital$n,
         Nonhospital = Nonhospital$n,
         Public = Public$n,
         Private = Private$n) |>
  relocate(Indicator, .before = Total)

# calculating no serivce
GH12_no <- data |>
  select(GH1, GH2, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gh12_no <- GH12_no |>
  filter(GH1 != "Yes" &
         GH2 != "Yes") |>
  count(GH2) |>
  summarise_at(vars(n), sum) |>
  mutate(GH2 = "Yes",
         Total = (n / total_sample) * 100,
         n = NULL)

urban_gh12_no <- GH12_no |>
  filter(`urban/rural`== "Urban") |>
  filter(GH1 != "Yes" &
         GH2 != "Yes") |>
  count(GH2) |>
  summarise_at(vars(n), sum) |>
  mutate(GH2 = "Yes",
         Urban = (n / total_urban) * 100,
         n = NULL)

rural_gh12_no <- GH12_no |>
  filter(`urban/rural`== "Rural") |>
  filter(GH1 != "Yes" &
         GH2 != "Yes") |>
  count(GH2) |>
  summarise_at(vars(n), sum) |>
  mutate(GH2 = "Yes",
         Rural = (n / total_rural) * 100,
         n = NULL)

hospital_gh12_no <- GH12_no |>
  filter(`hospital/non-hospital` == "Hospital") |>
  filter(GH1 != "Yes" &
         GH2 != "Yes") |>
  count(GH2) |>
  summarise_at(vars(n), sum) |>
  mutate(GH2 = "Yes",
         Hospital = (n / total_hospital) * 100,
         n = NULL)

nonhospital_gh12_no <- GH12_no |>
  filter(`hospital/non-hospital` == "Non-Hospital") |>
  filter(GH1 != "Yes" &
         GH2 != "Yes") |>
  count(GH2) |>
  summarise_at(vars(n), sum) |>
  mutate(GH2 = "Yes",
         Nonhospital = (n / total_nonhospital) * 100,
         n = NULL)

public_gh12_no <- GH12_no |>
  filter(`public/private` == "Public") |>
  filter(GH1 != "Yes" &
         GH2 != "Yes") |>
  count(GH2) |>
  summarise_at(vars(n), sum) |>
  mutate(GH2 = "Yes",
         Public = (n / total_public) * 100,
         n = NULL)

private_gh12_no <- GH12_no |>
  filter(`public/private` == "Private") |>
  filter(GH1 != "Yes" &
         GH2 != "Yes") |>
  count(GH2) |>
  summarise_at(vars(n), sum) |>
  mutate(GH2 = "Yes",
         Private = (n / total_private) * 100,
         n = NULL)

# joining
no_service_hygiene <- total_gh12_no |>
  left_join(urban_gh12_no) |>
  left_join(rural_gh12_no) |>
  left_join(hospital_gh12_no) |>
  left_join(nonhospital_gh12_no) |>
  left_join(public_gh12_no) |>
  left_join(private_gh12_no) |>
  mutate(Indicator = "No service",
         GH2 = NULL,
         Total =  Total$n,
         Urban = Urban$n,
         Rural = Rural$n,
         Hospital = Hospital$n,
         Nonhospital = Nonhospital$n,
         Public = Public$n,
         Private = Private$n) |>
  relocate(Indicator, .before = Total)

# calculating limited
limited_hygiene <- tibble(
  Total = 100 - (basic_hygiene[2] + no_service_hygiene[2]),
  Urban = 100 - (basic_hygiene[3] + no_service_hygiene[3]),
  Rural = 100 - (basic_hygiene[4] + no_service_hygiene[4]),
  Hospital = 100 - (basic_hygiene[5] + no_service_hygiene[5]),
  Nonhospital = 100 - (basic_hygiene[6] + no_service_hygiene[6]),
  Public = 100 - (basic_hygiene[7] + no_service_hygiene[7]),
  Private = 100 - (basic_hygiene[8] + no_service_hygiene[8])) |>
  mutate(Indicator = "Limited",
         Total =  Total$Total,
         Urban = Urban$Urban,
         Rural = Rural$Rural,
         Hospital = Hospital$Hospital,
         Nonhospital = Nonhospital$Nonhospital,
         Public = Public$Public,
         Private = Private$Private) |>
  relocate(Indicator, .before = Total)

Healthcare waste Data

Waste segregation

Calculating waste segregation in consultation areas for each stratifier

Code
#calculate safe waste segregation
GWM1 <- data |>
  select(GWM1, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gwm1 <- GWM1 |>
  count(GWM1) |>
  mutate(Total = (n / sum(n))*100) |>
  select(GWM1, Total) |>
  filter(GWM1 == "Yes, waste is segregated  into three labelled bins")

urban_gwm1 <- GWM1 |>
  filter(`urban/rural`== "Urban") |>
  count(GWM1) |>
  mutate(Urban = (n / sum(n))*100)|>
  select(GWM1, Urban) |>
  filter(GWM1 == "Yes, waste is segregated  into three labelled bins")

rural_gwm1 <- GWM1 |>
  filter(`urban/rural`== "Rural") |>
  count(GWM1) |>
  mutate(Rural = (n / sum(n))*100)|>
  select(GWM1, Rural)|>
  filter(GWM1 == "Yes, waste is segregated  into three labelled bins")

hospital_gwm1 <- GWM1 |>
  filter(`hospital/non-hospital` == "Hospital") |>
  count(GWM1) |>
  mutate(Hospital = (n / sum(n))*100)|>
  select(GWM1, Hospital)|>
  filter(GWM1 == "Yes, waste is segregated  into three labelled bins")

nonhospital_gwm1 <- GWM1 |>
  filter(`hospital/non-hospital` == "Non-Hospital") |>
  count(GWM1) |>
  mutate(Nonhospital = (n / sum(n))*100)|>
  select(GWM1, Nonhospital)|>
  filter(GWM1 == "Yes, waste is segregated  into three labelled bins")

public_gwm1 <- GWM1 |>
  filter(`public/private` == "Public") |>
  count(GWM1) |>
  mutate(Public = (n / sum(n))*100)|>
  select(GWM1, Public)|>
  filter(GWM1 == "Yes, waste is segregated  into three labelled bins")

private_gwm1 <- GWM1 |>
  filter(`public/private` == "Private") |>
  count(GWM1) |>
  mutate(Private = (n / sum(n))*100)|>
  select(GWM1, Private)|>
  filter(GWM1 == "Yes, waste is segregated  into three labelled bins")

# joining
waste_seg <- total_gwm1 |>
  left_join(urban_gwm1) |>
  left_join(rural_gwm1) |>
  left_join(hospital_gwm1) |>
  left_join(nonhospital_gwm1) |>
  left_join(public_gwm1) |>
  left_join(private_gwm1) |>
  mutate(Indicator = "Safe waste segregation",
         GWM1 = NULL) |>
  relocate(Indicator, .before = Total)

Infectious waste treatment / disposal

Calculating Infectious waste treatment / disposal for each stratifier

Code
# calculating safe infectious waste treatment / disposal
GWM2 <- data |>
  select(WGM2, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gwm2 <- GWM2 |>
  count(WGM2) |>
  mutate(Total = (n / sum(n))*100) |>
  select(WGM2, Total)

urban_gwm2 <- GWM2 |>
  filter(`urban/rural`== "Urban") |>
  count(WGM2) |>
  mutate(Urban = (n / sum(n))*100)|>
  select(WGM2, Urban)

rural_gwm2 <- GWM2 |>
  filter(`urban/rural`== "Rural") |>
  count(WGM2) |>
  mutate(Rural = (n / sum(n))*100)|>
  select(WGM2, Rural)

hospital_gwm2 <- GWM2 |>
  filter(`hospital/non-hospital` == "Hospital") |>
  count(WGM2) |>
  mutate(Hospital = (n / sum(n))*100)|>
  select(WGM2, Hospital)

nonhospital_gwm2 <- GWM2 |>
  filter(`hospital/non-hospital` == "Non-Hospital") |>
  count(WGM2) |>
  mutate(Nonhospital = (n / sum(n))*100)|>
  select(WGM2, Nonhospital)

public_gwm2 <- GWM2 |>
  filter(`public/private` == "Public") |>
  count(WGM2) |>
  mutate(Public = (n / sum(n))*100)|>
  select(WGM2, Public)

private_gwm2 <- GWM2 |>
  filter(`public/private` == "Private") |>
  count(WGM2) |>
  mutate(Private = (n / sum(n))*100)|>
  select(WGM2, Private)

# joining
infcs_waste <- total_gwm2 |>
  left_join(urban_gwm2) |>
  left_join(rural_gwm2) |>
  left_join(hospital_gwm2) |>
  left_join(nonhospital_gwm2) |>
  left_join(public_gwm2) |>
  left_join(private_gwm2)

# replacing NA with zero
infcs_waste <- infcs_waste |>
  replace(is.na(infcs_waste), 0)

# calculate safe
safe_infcs_waste <- infcs_waste |>
  filter(WGM2 == "Incinerated (other)" |
         WGM2 == "Not treated, but burried in lined, protected pit") |>
  summarise_at(vars(Total, Urban, Rural, Hospital, Nonhospital, Public, Private), sum)|>
  mutate(Indicator = "Safe infectious waste treatment / disposal") |>
  relocate(Indicator, .before = Total)

Sharps waste treatment / disposal

Calculating sharps waste treatment / disposal for each stratifier

Code
# calculating safe sharps waste treatment / disposal
GWM3 <- data |>
  select(GWM3, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gwm3 <- GWM3 |>
  count(GWM3) |>
  mutate(Total = (n / sum(n))*100) |>
  select(GWM3, Total)

urban_gwm3 <- GWM3 |>
  filter(`urban/rural`== "Urban") |>
  count(GWM3) |>
  mutate(Urban = (n / sum(n))*100)|>
  select(GWM3, Urban)

rural_gwm3 <- GWM3 |>
  filter(`urban/rural`== "Rural") |>
  count(GWM3) |>
  mutate(Rural = (n / sum(n))*100)|>
  select(GWM3, Rural)

hospital_gwm3 <- GWM3 |>
  filter(`hospital/non-hospital` == "Hospital") |>
  count(GWM3) |>
  mutate(Hospital = (n / sum(n))*100)|>
  select(GWM3, Hospital)

nonhospital_gwm3 <- GWM3 |>
  filter(`hospital/non-hospital` == "Non-Hospital") |>
  count(GWM3) |>
  mutate(Nonhospital = (n / sum(n))*100)|>
  select(GWM3, Nonhospital)

public_gwm3 <- GWM3 |>
  filter(`public/private` == "Public") |>
  count(GWM3) |>
  mutate(Public = (n / sum(n))*100)|>
  select(GWM3, Public)

private_gwm3 <- GWM3 |>
  filter(`public/private` == "Private") |>
  count(GWM3) |>
  mutate(Private = (n / sum(n))*100)|>
  select(GWM3, Private)

# joining
sharp_waste <- total_gwm3 |>
  left_join(urban_gwm3) |>
  left_join(rural_gwm3) |>
  left_join(hospital_gwm3) |>
  left_join(nonhospital_gwm3) |>
  left_join(public_gwm3) |>
  left_join(private_gwm3)

# replacing NA with zero
sharp_waste <- sharp_waste |>
  replace(is.na(sharp_waste), 0)

# calculate safe
safe_sharp_waste <- sharp_waste |>
  filter(GWM3 == "Incinerated (other)" |
         GWM3 == "Not treated, but buried in lined, protected pit") |>
  summarise_at(vars(Total, Urban, Rural, Hospital, Nonhospital, Public, Private), sum)|>
  mutate(Indicator = "Safe sharps waste treatment / disposal") |>
  relocate(Indicator, .before = Total)

Basic and limited services

Calculating basic and limited service for each stratifier

Code
# calculating basic
GWM123 <- data |>
  select(GWM1, WGM2, GWM3, `urban/rural`, `hospital/non-hospital`, `public/private`)

basic_total <- GWM123 |>
  filter(GWM1 == "Yes, waste is segregated  into three labelled bins") |>
  filter(WGM2 == "Incinerated (other)" |
         WGM2 == "Not treated, but burried in lined, protected pit") |>
  filter(GWM3 == "Incinerated (other)" |
         GWM3 == "Not treated, but buried in lined, protected pit") |>
  count(GWM1) |>
  mutate(Total = (n / total_sample)*100) |>
  select(GWM1, Total)

basic_urban <- GWM123 |>
  filter(`urban/rural`== "Urban") |>
  filter(GWM1 == "Yes, waste is segregated  into three labelled bins") |>
  filter(WGM2 == "Incinerated (other)" |
         WGM2 == "Not treated, but burried in lined, protected pit") |>
  filter(GWM3 == "Incinerated (other)" |
         GWM3 == "Not treated, but buried in lined, protected pit") |>
  count(GWM1) |>
  mutate(Urban = (n / total_urban)*100) |>
  select(GWM1, Urban)

basic_rural <- GWM123 |>
  filter(`urban/rural`== "Rural") |>
  filter(GWM1 == "Yes, waste is segregated  into three labelled bins") |>
  filter(WGM2 == "Incinerated (other)" |
         WGM2 == "Not treated, but burried in lined, protected pit") |>
  filter(GWM3 == "Incinerated (other)" |
         GWM3 == "Not treated, but buried in lined, protected pit") |>
  count(GWM1) |>
  mutate(Rural = (n / total_rural)*100) |>
  select(GWM1, Rural)

basic_hospital <- GWM123 |>
  filter(`hospital/non-hospital`== "Hospital") |>
  filter(GWM1 == "Yes, waste is segregated  into three labelled bins") |>
  filter(WGM2 == "Incinerated (other)" |
         WGM2 == "Not treated, but burried in lined, protected pit") |>
  filter(GWM3 == "Incinerated (other)" |
         GWM3 == "Not treated, but buried in lined, protected pit") |>
  count(GWM1) |>
  mutate(Hospital = (n / total_hospital)*100) |>
  select(GWM1, Hospital)

basic_nonhospital <- GWM123 |>
  filter(`hospital/non-hospital`== "Non-Hospital") |>
  filter(GWM1 == "Yes, waste is segregated  into three labelled bins") |>
  filter(WGM2 == "Incinerated (other)" |
         WGM2 == "Not treated, but burried in lined, protected pit") |>
  filter(GWM3 == "Incinerated (other)" |
         GWM3 == "Not treated, but buried in lined, protected pit") |>
  count(GWM1) |>
  mutate(Nonhospital = (n / total_nonhospital)*100) |>
  select(GWM1, Nonhospital)

basic_public <- GWM123 |>
  filter(`public/private`== "Public") |>
  filter(GWM1 == "Yes, waste is segregated  into three labelled bins") |>
  filter(WGM2 == "Incinerated (other)" |
         WGM2 == "Not treated, but burried in lined, protected pit") |>
  filter(GWM3 == "Incinerated (other)" |
         GWM3 == "Not treated, but buried in lined, protected pit") |>
  count(GWM1) |>
  mutate(Public = (n / total_public)*100) |>
  select(GWM1, Public)

basic_private <- GWM123 |>
  filter(`public/private`== "Private") |>
  filter(GWM1 == "Yes, waste is segregated  into three labelled bins") |>
  filter(WGM2 == "Incinerated (other)" |
         WGM2 == "Not treated, but burried in lined, protected pit") |>
  filter(GWM3 == "Incinerated (other)" |
         GWM3 == "Not treated, but buried in lined, protected pit") |>
  count(GWM1) |>
  mutate(Private = (n / total_private)*100) |>
  select(GWM1, Private)

# joining
basic_waste <- basic_total |>
  left_join(basic_urban) |>
  left_join(basic_rural) |>
  left_join(basic_hospital) |>
  left_join(basic_nonhospital) |>
  left_join(basic_public) |>
  left_join(basic_private) |>
  mutate(Indicator = "Basic",
         GWM1 = NULL,
         Total =  Total$n,
         Urban = Urban$n,
         Rural = Rural$n,
         Hospital = Hospital$n,
         Nonhospital = Nonhospital$n,
         Public = Public$n,
         Private = Private$n) |>
  relocate(Indicator, .before = Total)

# calculating no service
no_service_total <- GWM123 |>
  filter(GWM1 != "Yes, waste is segregated  into three labelled bins") |>
  filter(WGM2 != "Incinerated (other)" &
         WGM2 != "Not treated, but burried in lined, protected pit") |>
  filter(GWM3 != "Incinerated (other)" &
         GWM3 != "Not treated, but buried in lined, protected pit") |>
  count(GWM1) |>
  summarise_at(vars(n), sum) |>
  mutate(Total = (n / total_sample)*100,
         n = NULL,
         Indicator = "No service") |>
  relocate(Indicator, .before = Total)

no_service_urban <- GWM123 |>
  filter(`urban/rural`== "Urban") |>
  filter(GWM1 != "Yes, waste is segregated  into three labelled bins") |>
  filter(WGM2 != "Incinerated (other)" &
         WGM2 != "Not treated, but burried in lined, protected pit") |>
  filter(GWM3 != "Incinerated (other)" &
         GWM3 != "Not treated, but buried in lined, protected pit") |>
  count(GWM1) |>
  summarise_at(vars(n), sum) |>
  mutate(Urban = (n / total_urban)*100,
         n = NULL,
         Indicator = "No service") |>
  relocate(Indicator, .before = Urban)

no_service_rural <- GWM123 |>
  filter(`urban/rural`== "Rural") |>
  filter(GWM1 != "Yes, waste is segregated  into three labelled bins") |>
  filter(WGM2 != "Incinerated (other)" &
         WGM2 != "Not treated, but burried in lined, protected pit") |>
  filter(GWM3 != "Incinerated (other)" &
         GWM3 != "Not treated, but buried in lined, protected pit") |>
  count(GWM1) |>
  summarise_at(vars(n), sum) |>
  mutate(Rural = (n / total_rural)*100,
         n = NULL,
         Indicator = "No service") |>
  relocate(Indicator, .before = Rural)

no_service_hospital <- GWM123 |>
  filter(`hospital/non-hospital`== "Hospital") |>
  filter(GWM1 != "Yes, waste is segregated  into three labelled bins") |>
  filter(WGM2 != "Incinerated (other)" &
         WGM2 != "Not treated, but burried in lined, protected pit") |>
  filter(GWM3 != "Incinerated (other)" &
         GWM3 != "Not treated, but buried in lined, protected pit") |>
  count(GWM1) |>
  summarise_at(vars(n), sum) |>
  mutate(Hospital = (n / total_hospital)*100,
         n = NULL,
         Indicator = "No service") |>
  relocate(Indicator, .before = Hospital)

no_service_nonhospital <- GWM123 |>
  filter(`hospital/non-hospital`== "Non-Hospital") |>
  filter(GWM1 != "Yes, waste is segregated  into three labelled bins") |>
  filter(WGM2 != "Incinerated (other)" &
         WGM2 != "Not treated, but burried in lined, protected pit") |>
  filter(GWM3 != "Incinerated (other)" &
         GWM3 != "Not treated, but buried in lined, protected pit") |>
  count(GWM1) |>
  summarise_at(vars(n), sum) |>
  mutate(Nonhospital = (n / total_nonhospital)*100,
         n = NULL,
         Indicator = "No service") |>
  relocate(Indicator, .before = Nonhospital)

no_service_public <- GWM123 |>
  filter(`public/private`== "Public") |>
  filter(GWM1 != "Yes, waste is segregated  into three labelled bins") |>
  filter(WGM2 != "Incinerated (other)" &
         WGM2 != "Not treated, but burried in lined, protected pit") |>
  filter(GWM3 != "Incinerated (other)" &
         GWM3 != "Not treated, but buried in lined, protected pit") |>
  count(GWM1) |>
  summarise_at(vars(n), sum) |>
  mutate(Public = (n / total_public)*100,
         n = NULL,
         Indicator = "No service") |>
  relocate(Indicator, .before = Public)

no_service_private <- GWM123 |>
  filter(`public/private`== "Private") |>
  filter(GWM1 != "Yes, waste is segregated  into three labelled bins") |>
  filter(WGM2 != "Incinerated (other)" &
         WGM2 != "Not treated, but burried in lined, protected pit") |>
  filter(GWM3 != "Incinerated (other)" &
         GWM3 != "Not treated, but buried in lined, protected pit") |>
  count(GWM1) |>
  summarise_at(vars(n), sum) |>
  mutate(Private = (n / total_private)*100,
         n = NULL,
         Indicator = "No service") |>
  relocate(Indicator, .before = Private)

# joining
no_service_waste <- no_service_total |>
  left_join(no_service_urban) |>
  left_join(no_service_rural) |>
  left_join(no_service_hospital) |>
  left_join(no_service_nonhospital) |>
  left_join(no_service_public) |>
  left_join(no_service_private) |>
  mutate(Total =  Total$n,
         Urban = Urban$n,
         Rural = Rural$n,
         Hospital = Hospital$n,
         Nonhospital = Nonhospital$n,
         Public = Public$n,
         Private = Private$n)

# calculating limited
limited_waste <- tibble(
  Total = 100 - (basic_waste[2] + no_service_waste[2]),
  Urban = 100 - (basic_waste[3] + no_service_waste[3]),
  Rural = 100 - (basic_waste[4] + no_service_waste[4]),
  Hospital = 100 - (basic_waste[5] + no_service_waste[5]),
  Nonhospital = 100 - (basic_waste[6] + no_service_waste[6]),
  Public = 100 - (basic_waste[7] + no_service_waste[7]),
  Private = 100 - (basic_waste[8] + no_service_waste[8])) |>
  mutate(Indicator = "Limited",
         Total =  Total$Total,
         Urban = Urban$Urban,
         Rural = Rural$Rural,
         Hospital = Hospital$Hospital,
         Nonhospital = Nonhospital$Nonhospital,
         Public = Public$Public,
         Private = Private$Private) |>
  relocate(Indicator, .before = Total)

Environmental cleaning Data

Cleaning protocols

Calculating cleaning protocols for each stratifier

Code
#calculate cleaning protocols
GC1 <- data |>
  select(GC1, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gc1 <- GC1 |>
  count(GC1) |>
  mutate(Total = (n / sum(n))*100) |>
  select(GC1, Total) |>
  filter(GC1 == "Yes")

urban_gc1 <- GC1 |>
  filter(`urban/rural`== "Urban") |>
  count(GC1) |>
  mutate(Urban = (n / sum(n))*100)|>
  select(GC1, Urban) |>
  filter(GC1 == "Yes")

rural_gc1 <- GC1 |>
  filter(`urban/rural`== "Rural") |>
  count(GC1) |>
  mutate(Rural = (n / sum(n))*100)|>
  select(GC1, Rural)|>
  filter(GC1 == "Yes")

hospital_gc1 <- GC1 |>
  filter(`hospital/non-hospital` == "Hospital") |>
  count(GC1) |>
  mutate(Hospital = (n / sum(n))*100)|>
  select(GC1, Hospital)|>
  filter(GC1 == "Yes")

nonhospital_gc1 <- GC1 |>
  filter(`hospital/non-hospital` == "Non-Hospital") |>
  count(GC1) |>
  mutate(Nonhospital = (n / sum(n))*100)|>
  select(GC1, Nonhospital)|>
  filter(GC1 == "Yes")

public_gc1 <- GC1 |>
  filter(`public/private` == "Public") |>
  count(GC1) |>
  mutate(Public = (n / sum(n))*100)|>
  select(GC1, Public)|>
  filter(GC1 == "Yes")

private_gc1 <- GC1 |>
  filter(`public/private` == "Private") |>
  count(GC1) |>
  mutate(Private = (n / sum(n))*100)|>
  select(GC1, Private)|>
  filter(GC1 == "Yes")

# joining
protocols <- total_gc1 |>
  left_join(urban_gc1) |>
  left_join(rural_gc1) |>
  left_join(hospital_gc1) |>
  left_join(nonhospital_gc1) |>
  left_join(public_gc1) |>
  left_join(private_gc1) |>
  mutate(Indicator = "Cleaning protocols",
         GC1 = NULL) |>
  relocate(Indicator, .before = Total)

Training

Calculating training for each stratifier

Code
#calculate cleaning protocols
GC2 <- data |>
  select(GC2, `urban/rural`, `hospital/non-hospital`, `public/private`)

total_gc2 <- GC2 |>
  count(GC2) |>
  mutate(Total = (n / sum(n))*100) |>
  select(GC2, Total) |>
  filter(GC2 == "Yes, all have been trained")

urban_gc2 <- GC2 |>
  filter(`urban/rural`== "Urban") |>
  count(GC2) |>
  mutate(Urban = (n / sum(n))*100)|>
  select(GC2, Urban) |>
  filter(GC2 == "Yes, all have been trained")

rural_gc2 <- GC2 |>
  filter(`urban/rural`== "Rural") |>
  count(GC2) |>
  mutate(Rural = (n / sum(n))*100)|>
  select(GC2, Rural)|>
  filter(GC2 == "Yes, all have been trained")

hospital_gc2 <- GC2 |>
  filter(`hospital/non-hospital` == "Hospital") |>
  count(GC2) |>
  mutate(Hospital = (n / sum(n))*100)|>
  select(GC2, Hospital)|>
  filter(GC2 == "Yes, all have been trained")

nonhospital_gc2 <- GC2 |>
  filter(`hospital/non-hospital` == "Non-Hospital") |>
  count(GC2) |>
  mutate(Nonhospital = (n / sum(n))*100)|>
  select(GC2, Nonhospital)|>
  filter(GC2 == "Yes, all have been trained")

public_gc2 <- GC2 |>
  filter(`public/private` == "Public") |>
  count(GC2) |>
  mutate(Public = (n / sum(n))*100)|>
  select(GC2, Public)|>
  filter(GC2 == "Yes, all have been trained")

private_gc2 <- GC2 |>
  filter(`public/private` == "Private") |>
  count(GC2) |>
  mutate(Private = (n / sum(n))*100)|>
  select(GC2, Private)|>
  filter(GC2 == "Yes, all have been trained")

# joining
training <- total_gc2 |>
  left_join(urban_gc2) |>
  left_join(rural_gc2) |>
  left_join(hospital_gc2) |>
  left_join(nonhospital_gc2) |>
  left_join(public_gc2) |>
  left_join(private_gc2) |>
  mutate(Indicator = "Training",
         GC2 = NULL) |>
  relocate(Indicator, .before = Total)

Basic and limited services

Calculating basic and limited service for each stratifier

Code
# calculating basic
GC12 <- data |>
  select(GC1, GC2, `urban/rural`, `hospital/non-hospital`, `public/private`)

basic_total <- GC12 |>
  filter(GC1 == "Yes") |>
  filter(GC2 == "Yes, all have been trained") |>
  count(GC1) |>
  mutate(Total = (n / total_sample)*100) |>
  select(GC1, Total)

basic_urban <- GC12 |>
  filter(`urban/rural`== "Urban") |>
  filter(GC1 == "Yes") |>
  filter(GC2 == "Yes, all have been trained") |>
  count(GC1) |>
  mutate(Urban = (n / total_urban)*100) |>
  select(GC1, Urban)

basic_rural <- GC12 |>
  filter(`urban/rural`== "Rural") |>
  filter(GC1 == "Yes") |>
  filter(GC2 == "Yes, all have been trained") |>
  count(GC1) |>
  mutate(Rural = (n / total_rural)*100) |>
  select(GC1, Rural)

basic_hospital <- GC12 |>
  filter(`hospital/non-hospital`== "Hospital") |>
  filter(GC1 == "Yes") |>
  filter(GC2 == "Yes, all have been trained") |>
  count(GC1) |>
  mutate(Hospital = (n / total_hospital)*100) |>
  select(GC1, Hospital)

basic_nonhospital <- GC12 |>
  filter(`hospital/non-hospital`== "Non-Hospital") |>
  filter(GC1 == "Yes") |>
  filter(GC2 == "Yes, all have been trained") |>
  count(GC1) |>
  mutate(Nonhospital = (n / total_nonhospital)*100) |>
  select(GC1, Nonhospital)

basic_public <- GC12 |>
  filter(`public/private`== "Public") |>
  filter(GC1 == "Yes") |>
  filter(GC2 == "Yes, all have been trained") |>
  count(GC1) |>
  mutate(Public = (n / total_public)*100) |>
  select(GC1, Public)

basic_private <- GC12 |>
  filter(`public/private`== "Private") |>
  filter(GC1 == "Yes") |>
  filter(GC2 == "Yes, all have been trained") |>
  count(GC1) |>
  mutate(Private = (n / total_private)*100) |>
  select(GC1, Private)

# joining
basic_cleaning <- basic_total |>
  left_join(basic_urban) |>
  left_join(basic_rural) |>
  left_join(basic_hospital) |>
  left_join(basic_nonhospital) |>
  left_join(basic_public) |>
  left_join(basic_private) |>
  mutate(Indicator = "Basic",
         GC1 = NULL,
         Total =  Total$n,
         Urban = Urban$n,
         Rural = Rural$n,
         Hospital = Hospital$n,
         Nonhospital = Nonhospital$n,
         Public = Public$n,
         Private = Private$n) |>
  relocate(Indicator, .before = Total)

# calculating no service
no_service_total <- GC12 |>
  filter(GC1 == "No") |>
  filter(GC2 != "Yes, all have been trained") |>
  count(GC1) |>
  mutate(Total = (n / total_sample)*100,
         GC1 = NULL,
         n = NULL,
         Indicator = "No service") |>
  relocate(Indicator, .before = Total)

no_service_urban <- GC12 |>
  filter(`urban/rural`== "Urban") |>
  filter(GC1 == "No") |>
  filter(GC2 != "Yes, all have been trained") |>
  count(GC1) |>
  mutate(Urban = (n / total_urban)*100,
         GC1 = NULL,
         n = NULL,
         Indicator = "No service") |>
  relocate(Indicator, .before = Urban)

no_service_rural <- GC12 |>
  filter(`urban/rural`== "Rural") |>
  filter(GC1 == "No") |>
  filter(GC2 != "Yes, all have been trained") |>
  count(GC1) |>
  mutate(Rural = (n / total_rural)*100,
         GC1 = NULL,
         n = NULL,
         Indicator = "No service") |>
  relocate(Indicator, .before = Rural)

no_service_hospital <- GC12 |>
  filter(`hospital/non-hospital`== "Hospital") |>
  filter(GC1 == "No") |>
  filter(GC2 != "Yes, all have been trained") |>
  count(GC1) |>
  mutate(Hospital = (n / total_hospital)*100,
         GC1 = NULL,
         n = NULL,
         Indicator = "No service") |>
  relocate(Indicator, .before = Hospital)

no_service_nonhospital <- GC12 |>
  filter(`hospital/non-hospital`== "Non-Hospital") |>
  filter(GC1 == "No") |>
  filter(GC2 != "Yes, all have been trained") |>
  count(GC1) |>
  mutate(Nonhospital = (n / total_nonhospital)*100,
         GC1 = NULL,
         n = NULL,
         Indicator = "No service") |>
  relocate(Indicator, .before = Nonhospital)

no_service_public <- GC12 |>
  filter(`public/private`== "Public") |>
  filter(GC1 == "No") |>
  filter(GC2 != "Yes, all have been trained") |>
  count(GC1) |>
  mutate(Public = (n / total_public)*100,
         GC1 = NULL,
         n = NULL,
         Indicator = "No service") |>
  relocate(Indicator, .before = Public)

no_service_private <- GC12 |>
  filter(`public/private`== "Private") |>
  filter(GC1 == "No") |>
  filter(GC2 != "Yes, all have been trained") |>
  count(GC1) |>
  mutate(Private = (n / total_private)*100,
         GC1 = NULL,
         n = NULL,
         Indicator = "No service") |>
  relocate(Indicator, .before = Private)

# joining
no_service_cleaning <- no_service_total |>
  left_join(no_service_urban) |>
  left_join(no_service_rural) |>
  left_join(no_service_hospital) |>
  left_join(no_service_nonhospital) |>
  left_join(no_service_public) |>
  left_join(no_service_private) |>
  mutate(Total =  Total$n,
         Urban = Urban$n,
         Rural = Rural$n,
         Hospital = Hospital$n,
         Nonhospital = Nonhospital$n,
         Public = Public$n,
         Private = Private$n)

# calculating limited
limited_cleaning <- tibble(
  Total = 100 - (basic_cleaning[2] + no_service_cleaning[2]),
  Urban = 100 - (basic_cleaning[3] + no_service_cleaning[3]),
  Rural = 100 - (basic_cleaning[4] + no_service_cleaning[4]),
  Hospital = 100 - (basic_cleaning[5] + no_service_cleaning[5]),
  Nonhospital = 100 - (basic_cleaning[6] + no_service_cleaning[6]),
  Public = 100 - (basic_cleaning[7] + no_service_cleaning[7]),
  Private = 100 - (basic_cleaning[8] + no_service_cleaning[8])) |>
  mutate(Indicator = "Limited",
         Total =  Total$Total,
         Urban = Urban$Urban,
         Rural = Rural$Rural,
         Hospital = Hospital$Hospital,
         Nonhospital = Nonhospital$Nonhospital,
         Public = Public$Public,
         Private = Private$Private) |>
  relocate(Indicator, .before = Total)

Results

Water indicators

See Table 1 summarizes all water indicators resulted from the analysis.

Significant disparities in water indicators exist in terms of the types of facilities; facilities located in urban areas as well as hospitals are more likely to meet the criteria for basic water service than facilities located in rural areas and smaller health care facilities, respectively.

Code
improved_water_source |>
  full_join(on_premises) |>
  full_join(available) |>
  full_join(improved_available) |>
  full_join(improved_onpremises) |>
  full_join(basic_water) |>
  full_join(limited_water) |>
  full_join(no_service_water) |>
  kable(digits = 1)
Table 1: Water indicators
Indicator Total Urban Rural Hospital Nonhospital Public Private
Improved water source 92.2 96.1 84.5 95.8 90.6 92.0 92.4
On premises 51.8 59.3 36.9 54.7 50.5 54.8 47.1
Available 86.0 93.1 71.8 94.7 82.1 81.9 92.4
Improved and available 83.4 91.7 67.0 91.6 79.7 80.9 87.4
Improved and on premises 50.2 58.8 33.0 52.6 49.1 53.2 45.4
Basic 46.3 56.9 25.2 50.5 44.3 47.9 43.7
Limited 45.9 39.2 59.2 45.3 46.2 44.1 48.7
No service 7.8 3.9 15.5 4.2 9.4 8.0 7.6

Sanitation indicators

See Table 2 summarizes all sanitation indicators resulted from the analysis.

Significant disparities in sanitation indicators exist in terms of the types of facilities; facilities located in urban areas as well as hospitals are more likely to meet the criteria for basic sanitation service than facilities located in rural areas and smaller health care facilities, respectively.

Code
improved_san_fac |>
  full_join(san_usable) |>
  full_join(san_staff) |>
  full_join(san_sex) |>
  full_join(san_mhm) |>
  full_join(san_mobility) |>
  full_join(improved_usable) |>
  full_join(improved_staff) |>
  full_join(improved_sex) |>
  full_join(improved_mhm) |>
  full_join(improved_mobility) |>
  full_join(basic_san) |>
  full_join(limited_san) |>
  full_join(no_service_san) |>
  kable(digits = 1)
Table 2: Sanitation indicators
Indicator Total Urban Rural Hospital Nonhospital Public Private
Improved sanitation facility 94.8 95.6 93.2 95.8 94.3 95.7 93.3
Usable sanitation facility 77.9 89.2 55.3 85.3 74.5 77.1 79.0
Dedicated to staff 47.9 59.3 25.2 66.3 39.6 44.7 52.9
Sex-separated facility 39.4 51.5 15.5 62.1 29.2 33.0 49.6
Menstrual hygiene faciliy 15.3 20.1 5.8 27.4 9.9 16.5 13.4
Accessible for limited mobility 19.9 23.5 12.6 35.8 12.7 22.9 15.1
Improved and usable 74.3 85.3 52.4 81.1 71.2 73.4 75.6
Improved and staff 46.3 57.8 23.3 65.3 37.7 43.6 50.4
Improved and sex-separated 38.4 50.0 15.5 61.1 28.3 32.4 47.9
Improved and menstrual hygiene 15.3 20.1 5.8 27.4 9.9 16.5 13.4
Improved and limited mobility 19.2 23.0 11.7 34.7 12.3 21.8 15.1
Basic 7.8 11.3 1.0 15.8 4.2 9.6 5.0
Limited 87.0 84.3 92.2 80.0 90.1 86.2 88.2
No service 5.2 4.4 6.8 4.2 5.7 4.3 6.7

Hygiene indicators

See Table 3 summarizes all hygiene indicators resulted from the analysis.

Significant disparities in hygiene indicators exist in terms of the types of facilities; facilities located in urban areas as well as hospitals are more likely to meet the criteria for basic hygiene service than facilities located in rural areas and smaller health care facilities, respectively.

Code
pointsofcare |>
  full_join(toilets) |>
  full_join(toilets_fun) |>
  full_join(basic_hygiene) |>
  full_join(limited_hygiene) |>
  full_join(no_service_hygiene) |>
  kable(digits = 1)
Table 3: Hygiene indicators
Indicator Total Urban Rural Hospital Nonhospital Public Private
Handwashing facilities with water and soap at points of care 48.9 59.3 28.2 62.1 42.9 47.3 51.3
Handwashing facilities within 5 metres of toilets 74.6 74.5 74.8 78.9 72.6 78.7 68.1
Handwashing facilities within 5 metres of toilets with water and soap 46.3 57.8 23.3 62.1 39.2 47.3 44.5
Basic 42.0 52.0 22.3 56.8 35.4 41.5 42.9
Limited 11.1 13.2 6.8 10.5 11.3 11.7 10.1
No service 46.9 34.8 70.9 32.6 53.3 46.8 47.1

Healthcare waste management indicators

See Table 4 summarizes all healthcare waste indicators resulted from the analysis.

Minor disparities in waste indicators exist in terms of the types of facilities; however, facilities located in urban areas as well as hospitals are more likely to meet the criteria for basic healthcare waste service than facilities located in rural areas and smaller health care facilities, respectively.

Code
waste_seg |>
  full_join(safe_infcs_waste) |>
  full_join(safe_sharp_waste) |>
  full_join(basic_waste) |>
  full_join(limited_waste) |>
  full_join(no_service_waste) |>
  kable(digits = 1)
Table 4: Healthcare waste management indicators
Indicator Total Urban Rural Hospital Nonhospital Public Private
Safe waste segregation 40.1 46.1 28.2 56.8 32.5 43.1 35.3
Safe infectious waste treatment / disposal 36.8 43.1 24.3 56.8 27.8 38.3 34.5
Safe sharps waste treatment / disposal 38.4 43.1 29.1 49.5 33.5 44.1 29.4
Basic 16.6 18.6 12.6 26.3 12.3 21.8 8.4
Limited 44.6 51.0 32.0 53.7 40.6 42.6 47.9
No service 38.8 30.4 55.3 20.0 47.2 35.6 43.7

Environmental cleaning indicators

See Table 5 summarizes environmental cleaning indicators resulted from the analysis.

Minor disparities in environmental cleaning indicators exist in terms of the types of facilities; however, facilities located in urban areas as well as hospitals are more likely to meet the criteria for basic environmental cleaning service than facilities located in rural areas and smaller health care facilities, respectively.

Code
protocols |>
  full_join(training) |>
  full_join(basic_cleaning) |>
  full_join(limited_cleaning) |>
  full_join(no_service_cleaning) |>
  kable(digits = 1)
Table 5: Environmental cleaning indicators
Indicator Total Urban Rural Hospital Nonhospital Public Private
Cleaning protocols 29.3 33.8 20.4 42.1 23.6 30.9 26.9
Training 19.5 21.1 16.5 34.7 12.7 18.1 21.8
Basic 12.1 14.7 6.8 23.2 7.1 10.1 15.1
Limited 24.8 25.5 23.3 30.5 22.2 28.7 18.5
No service 63.2 59.8 69.9 46.3 70.8 61.2 66.4

Conclusion

Basic water ladder

See Figure 1 illustrates basic water ladder resulted from the analysis. Significant disparities are depicted in the basic water ladders across all settings.

Code
# create object
basic_water_ladder <-
  (basic_water) |>
  full_join(limited_water) |>
  full_join(no_service_water)

# pivot
basic_water_ladder <-
  basic_water_ladder |>
  pivot_longer(cols = Total:Private,
             names_to = "Setting",
             values_to = "Percent")

# reorder indicators
basic_water_ladder$Indicator <- factor(basic_water_ladder$Indicator, levels = c("No service", "Limited", "Basic"))

# reorder settings
basic_water_ladder$Setting <- factor(basic_water_ladder$Setting, levels = c("Total", "Urban", "Rural", "Hospital", "Nonhospital", "Public", "Private"))

# Assigning white for basic in geom_text
basic_water_ladder <- basic_water_ladder |>
  mutate(Color = case_when(
    Indicator == "Basic" ~ "white",
    .default = "black"))

# plot water ladders
ggplot(data = basic_water_ladder,
       mapping = aes(x = Setting,
                     y = Percent,
                     fill = Indicator)) +
  geom_col() +
  geom_text(aes(label = round(Percent, 0)),
            position = position_stack(vjust = 0.5),
            size = 3,
            color = basic_water_ladder$Color) +
  theme_minimal() +
  labs(title = "Water Indicator",
       subtitle = "JMP basic water service ladder",
       x = "Setting",
       y = "Proportion of healthcare facilities (%)") +
  scale_fill_manual(
    values = c("No service" = "#FEBC11", "Limited" = "#FFF176", "Basic" = "#00B8EC"),
    breaks = c("No service", "Limited","Basic")) +
  guides(fill = guide_legend(title = NULL)) +
  theme(panel.grid.minor.y = element_blank(),
        panel.grid.major.x = element_blank())
Figure 1: Basic water ladder

Basic sanitation ladder

See Figure 2 illustrates basic sanitation ladder resulted from the analysis. Basic estimates are too low across all settings.

Code
#create object
basic_san_ladder <-
  (basic_san) |>
  full_join(limited_san) |>
  full_join(no_service_san)

#pivot
basic_san_ladder <-
  basic_san_ladder |>
  pivot_longer(cols = Total:Private,
             names_to = "Setting",
             values_to = "Percent")

#reorder indicators
basic_san_ladder$Indicator <- factor(basic_san_ladder$Indicator, levels = c("No service", "Limited", "Basic"))

#reorder settings
basic_san_ladder$Setting <- factor(basic_san_ladder$Setting, levels = c("Total", "Urban", "Rural", "Hospital", "Nonhospital", "Public", "Private"))

# Assigning white for basic in geom_text
basic_san_ladder <- basic_san_ladder |>
  mutate(Color = case_when(
    Indicator == "Basic" ~ "white",
    .default = "black"))

# plot sanitation ladders
ggplot(data = basic_san_ladder,
       mapping = aes(x = Setting,
                     y = Percent,
                     fill = Indicator)) +
  geom_col() +
  geom_text(aes(label = round(Percent, 0)),
            position = position_stack(vjust = 0.5),
            size = 3,
            color = basic_san_ladder$Color) +
  theme_minimal() +
  labs(title = "Sanitation Indicator",
       subtitle = "JMP basic sanitation service ladder",
       x = "Setting",
       y = "Proportion of healthcare facilities (%)") +
  scale_fill_manual(
    values = c("No service" = "#FEBC11", "Limited" = "#FFF176", "Basic" = "#66BB6A"),
    breaks = c("No service", "Limited","Basic")) +
  guides(fill = guide_legend(title = NULL)) +
  theme(panel.grid.minor.y = element_blank(),
        panel.grid.major.x = element_blank())
Figure 2: Basic sanitation ladder

Basic hygiene ladder

See Figure 3 illustrates basic hygiene ladder resulted from the analysis. Significant disparities are depicted in the basic hygiene ladders across all settings.

Code
# create object
basic_hygiene_ladder <-
  (basic_hygiene) |>
  full_join(limited_hygiene) |>
  full_join(no_service_hygiene)

# pivot
basic_hygiene_ladder <-
  basic_hygiene_ladder |>
  pivot_longer(cols = Total:Private,
             names_to = "Setting",
             values_to = "Percent")

# reorder indicators
basic_hygiene_ladder$Indicator <- factor(basic_hygiene_ladder$Indicator, levels = c("No service", "Limited", "Basic"))

# reorder settings
basic_hygiene_ladder$Setting <- factor(basic_hygiene_ladder$Setting, levels = c("Total", "Urban", "Rural", "Hospital", "Nonhospital", "Public", "Private"))

# Assigning white for basic in geom_text
basic_hygiene_ladder <- basic_hygiene_ladder |>
  mutate(Color = case_when(
    Indicator == "Basic" ~ "white",
    .default = "black"))

# plot hygiene ladders
ggplot(data = basic_hygiene_ladder,
       mapping = aes(x = Setting,
                     y = Percent,
                     fill = Indicator)) +
  geom_col() +
  geom_text(aes(label = round(Percent, 0)),
            position = position_stack(vjust = 0.5),
            size = 3,
            color = basic_hygiene_ladder$Color) +
  theme_minimal() +
  labs(title = "Hygiene Indicator",
       subtitle = "JMP basic hygiene service ladder",
       x = "Setting",
       y = "Proportion of healthcare facilities (%)") +
  scale_fill_manual(
    values = c("No service" = "#FEBC11", "Limited" = "#FFF176", "Basic" = "#AB47BC"),
    breaks = c("No service", "Limited","Basic")) +
  guides(fill = guide_legend(title = NULL)) +
  theme(panel.grid.minor.y = element_blank(),
        panel.grid.major.x = element_blank())
Figure 3: Basic hygiene ladder

Basic healthcare waste ladder

See Figure 4 illustrates basic healthcare waste ladder resulted from the analysis. Basic estimates are too low across all settings.

Code
# create object
basic_waste_ladder <-
  (basic_waste) |>
  full_join(limited_waste) |>
  full_join(no_service_waste)

# pivot
basic_waste_ladder <-
  basic_waste_ladder |>
  pivot_longer(cols = Total:Private,
             names_to = "Setting",
             values_to = "Percent")

# reorder indicators
basic_waste_ladder$Indicator <- factor(basic_waste_ladder$Indicator, levels = c("No service", "Limited", "Basic"))

# reorder settings
basic_waste_ladder$Setting <- factor(basic_waste_ladder$Setting, levels = c("Total", "Urban", "Rural", "Hospital", "Nonhospital", "Public", "Private"))

# Assigning white for basic in geom_text
basic_waste_ladder <- basic_waste_ladder |>
  mutate(Color = case_when(
    Indicator == "Basic" ~ "white",
    .default = "black"))

# plot waste ladders
ggplot(data = basic_waste_ladder,
       mapping = aes(x = Setting,
                     y = Percent,
                     fill = Indicator)) +
  geom_col() +
  geom_text(aes(label = round(Percent, 0)),
            position = position_stack(vjust = 0.5),
            size = 3,
            color = basic_waste_ladder$Color) +
  theme_minimal() +
  labs(title = "Healthcare Waste Indicator",
       subtitle = "JMP basic healthcare waste service ladder",
       x = "Setting",
       y = "Proportion of healthcare facilities (%)") +
  scale_fill_manual(
    values = c("No service" = "#FEBC11", "Limited" = "#FFF176", "Basic" = "#EF5350"),
    breaks = c("No service", "Limited","Basic")) +
  guides(fill = guide_legend(title = NULL)) +
  theme(panel.grid.minor.y = element_blank(),
        panel.grid.major.x = element_blank())
Figure 4: Basic healthcare waste ladder

Basic environmental cleaning ladder

See Figure 5 illustrates basic environmental cleaning ladder resulted from the analysis. Basic estimates are too low across all settings.

Code
# create object
basic_cleaning_ladder <-
  (basic_cleaning) |>
  full_join(limited_cleaning) |>
  full_join(no_service_cleaning)

# pivot
basic_cleaning_ladder <-
  basic_cleaning_ladder |>
  pivot_longer(cols = Total:Private,
             names_to = "Setting",
             values_to = "Percent")

# reorder indicators
basic_cleaning_ladder$Indicator <- factor(basic_cleaning_ladder$Indicator, levels = c("No service", "Limited", "Basic"))

# reorder settings
basic_cleaning_ladder$Setting <- factor(basic_cleaning_ladder$Setting, levels = c("Total", "Urban", "Rural", "Hospital", "Nonhospital", "Public", "Private"))

# Assigning white for basic in geom_text
basic_cleaning_ladder <- basic_cleaning_ladder |>
  mutate(Color = case_when(
    Indicator == "Basic" ~ "white",
    .default = "black"))

# plot environmental cleaning ladders
ggplot(data = basic_cleaning_ladder,
       mapping = aes(x = Setting,
                     y = Percent,
                     fill = Indicator)) +
  geom_col() +
  geom_text(aes(label = round(Percent, 0)),
            position = position_stack(vjust = 0.5),
            size = 3,
            color = basic_cleaning_ladder$Color) +
  theme_minimal() +
  labs(title = "Environmental Cleaning Indicator",
       subtitle = "JMP basic environmental cleaning service ladder",
       x = "Setting",
       y = "Proportion of healthcare facilities (%)") +
  scale_fill_manual(
    values = c("No service" = "#FEBC11", "Limited" = "#FFF176", "Basic" = "#EC008C"),
    breaks = c("No service", "Limited","Basic")) +
  guides(fill = guide_legend(title = NULL)) +
  theme(panel.grid.minor.y = element_blank(),
        panel.grid.major.x = element_blank())
Figure 5: Basic environmental cleaning ladder

References

  1. WHO & UNICEF (2017)
  2. WHO & UNICEF (2019)

References

WHO, & UNICEF. (2017). JMP Methodology: 2017 update and SDG baselines. https://washdata.org/reports/jmp-2017-methodology
WHO, & UNICEF. (2019). Core questions and indicators for monitoring WASH in Health Care Facilities in the Sustainable Development Goals. https://washdata.org/reports/jmp-2018-core-questions-and-indicators-wash-in-health-care-facilities

Reuse

Citation

BibTeX citation:
@online{shakkour2024,
  author = {Shakkour, Mohammad},
  title = {Producing {JMP} Estimates},
  date = {2024-03-15},
  url = {https://github.com/Shakkour726},
  langid = {en}
}
For attribution, please cite this work as:
Shakkour, M. (2024, March 15). Producing JMP estimates. WASH in Healthcare Facilities. https://github.com/Shakkour726