# Load required libraries
library(tidyverse)
library(readxl)
library(here)
library(knitr)
library(gt)
# Set global options
knitr::opts_chunk$set(
echo = TRUE,
message = FALSE,
warning = FALSE,
fig.width = 10,
fig.height = 6
)Access to WASH Services in Schools Worldwide
A Data Analysis Capstone Project
Introduction
Access to Water, Sanitation, and Hygiene (WASH) services in schools is essential for children’s health, dignity, and education. This report analyzes global data on WASH services in schools to understand current coverage levels and identify regions that need improvement.
According to UNICEF and WHO (2020), millions of children attend schools without basic WASH facilities, which affects their health and learning outcomes. The lack of proper sanitation and hygiene facilities disproportionately affects girls, often leading to increased absenteeism (Adams, Bartram, and Chartier 2018).
This analysis examines three key questions:
- What is the current state of WASH services in schools globally?
- Which regions have the lowest access to basic WASH services?
- Are there disparities between urban and rural schools?
Methods
Data Source
The data for this analysis comes from the UNICEF/WHO Joint Monitoring Programme (JMP) database on WASH in schools. The dataset includes information on water, sanitation, and hygiene services across different countries and regions from 2000 to 2023.
Data Processing
Data was imported from the raw Excel file, cleaned, and prepared for analysis. The cleaning process included:
- Renaming columns for clarity
- Converting percentage values to numeric format
- Removing rows with missing country or year data
- Handling missing values (represented as “-” in the original data)
# Load the raw data
raw_data <- read_excel(
here("data/raw/WASH_in_school.xlsx"),
sheet = "WASH"
)
# Display first few rows
head(raw_data, 3) %>%
kable(caption = "Sample of raw data")| COUNTRY, AREA OR TERRITORY | Year | School age population (thousands) | % urban | % pre-primary | % primary | % secondary | TOTAL…8 | …9 | …10 | URBAN…11 | …12 | …13 | RURAL…14 | …15 | …16 | PRE-PRIMARY…17 | …18 | …19 | PRIMARY…20 | …21 | …22 | SECONDARY…23 | …24 | …25 | TOTAL…26 | …27 | …28 | URBAN…29 | …30 | …31 | RURAL…32 | …33 | …34 | PRE-PRIMARY…35 | …36 | …37 | PRIMARY…38 | …39 | …40 | SECONDARY…41 | …42 | …43 | TOTAL…44 | …45 | …46 | URBAN…47 | …48 | …49 | RURAL…50 | …51 | …52 | PRE-PRIMARY…53 | …54 | …55 | PRIMARY…56 | …57 | …58 | SECONDARY…59 | …60 | …61 | SDG region | WHO Region | UNICEF Programme Region | UNICEF Reporting Regions | UNESCO UIS Regions | UNESCO GEMR Regions | iso3 code |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| NA | NA | NA | NA | NA | NA | NA | Basic water services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved and available) | Limited water services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved, not available) | No water service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (no facility or unimproved) | Basic water services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved and available) | Limited water services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved, not available) | No water service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (no facility or unimproved) | Basic water services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved and available) | Limited water services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved, not available) | No water service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (no facility or unimproved) | Basic water services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved and available) | Limited water services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved, not available) | No water service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (no facility or unimproved) | Basic water services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved and available) | Limited water services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved, not available) | No water service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (no facility or unimproved) | Basic water services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved and available) | Limited water services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved, not available) | No water service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (no facility or unimproved) | Basic sanitation services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved, usable and single-sex) | Limited sanitation services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved, not usable or not single-sex) | No sanitation service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (no facility or unimproved) | Basic sanitation services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved, usable and single-sex) | Limited sanitation services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved, not usable or not single-sex) | No sanitation service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (no facility or unimproved) | Basic sanitation services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved, usable and single-sex) | Limited sanitation services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved, not usable or not single-sex) | No sanitation service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (no facility or unimproved) | Basic sanitation services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved, usable and single-sex) | Limited sanitation services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved, not usable or not single-sex) | No sanitation service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (no facility or unimproved) | Basic sanitation services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved, usable and single-sex) | Limited sanitation services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved, not usable or not single-sex) | No sanitation service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (no facility or unimproved) | Basic sanitation services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved, usable and single-sex) | Limited sanitation services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (improved, not usable or not single-sex) | No sanitation service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (no facility or unimproved) | Basic hygiene services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (facility with water and soap) | Limited hygiene services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (facility with water, but no soap) | No hygiene service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (no facility or no water) | Basic hygiene services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (facility with water and soap) | Limited hygiene services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (facility with water, but no soap) | No hygiene service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (no facility or no water) | Basic hygiene services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (facility with water and soap) | Limited hygiene services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (facility with water, but no soap) | No hygiene service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (no facility or no water) | Basic hygiene services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (facility with water and soap) | Limited hygiene services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (facility with water, but no soap) | No hygiene service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (no facility or no water) | Basic hygiene services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (facility with water and soap) | Limited hygiene services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (facility with water, but no soap) | No hygiene service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (no facility or no water) | Basic hygiene services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (facility with water and soap) | Limited hygiene services | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (facility with water, but no soap) | No hygiene service | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| (no facility or no water) | NA | NA | NA | NA | NA | NA | NA | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| NA | 2000 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | Europe and Northern America | Europe | Europe and Central Asia | Europe and Central Asia | Central and Eastern Europe | Europe and Northern America | MNE |
| NA | 2000 | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | Eastern and South-Eastern Asia | South-East Asia | East Asia and Pacific | East Asia and Pacific | East Asia and the Pacific | Eastern and South-eastern Asia | TLS |
# Clean and process the data
processed_data <- raw_data |>
rename(
country = 1,
year = 2,
school_age_pop_thousands = 3,
pct_urban = 4,
pct_pre_primary = 5,
pct_primary = 6,
pct_secondary = 7,
water_basic_total = 8,
water_limited_total = 9,
water_none_total = 10,
water_basic_urban = 11,
water_limited_urban = 12,
water_none_urban = 13,
water_basic_rural = 14,
water_limited_rural = 15,
water_none_rural = 16,
sanitation_basic_total = 26,
sanitation_limited_total = 27,
sanitation_none_total = 28,
sanitation_basic_urban = 29,
sanitation_limited_urban = 30,
sanitation_none_urban = 31,
sanitation_basic_rural = 32,
sanitation_limited_rural = 33,
sanitation_none_rural = 34,
hygiene_basic_total = 44,
hygiene_limited_total = 45,
hygiene_none_total = 46,
hygiene_basic_urban = 47,
hygiene_limited_urban = 48,
hygiene_none_urban = 49,
hygiene_basic_rural = 50,
hygiene_limited_rural = 51,
hygiene_none_rural = 52,
sdg_region = 62,
who_region = 63,
iso3 = 68
) |>
filter(!is.na(country), !is.na(year)) |>
mutate(across(c(pct_urban, pct_pre_primary, pct_primary, pct_secondary,
school_age_pop_thousands),
~as.numeric(na_if(., "-")))) |>
mutate(across(starts_with("water_") | starts_with("sanitation_") |
starts_with("hygiene_"),
~as.numeric(na_if(., "-")))) |>
mutate(year = as.integer(year)) |>
mutate(across(where(is.character), str_trim)) |>
arrange(country, year)
# Save processed data
write_csv(processed_data, here("data/processed/wash_schools_processed.csv"))The processed dataset contains 4979 observations from 192 countries, covering years from 0 to 2023.
Results
Global Overview of WASH Services
First, let’s examine the overall state of WASH services in schools globally using the most recent data available.
# Get latest year data for each country
latest_data <- processed_data |>
group_by(country) |>
filter(year == max(year)) |>
ungroup()
# Calculate global averages
global_summary <- latest_data |>
summarise(
avg_water = mean(water_basic_total, na.rm = TRUE),
avg_sanitation = mean(sanitation_basic_total, na.rm = TRUE),
avg_hygiene = mean(hygiene_basic_total, na.rm = TRUE)
)
global_summary |>
kable(
col.names = c("Water (%)", "Sanitation (%)", "Hygiene (%)"),
digits = 1,
caption = "Global average of schools with basic WASH services"
)| Water (%) | Sanitation (%) | Hygiene (%) |
|---|---|---|
| 70.2 | 67.7 | 62.4 |
Figure 1 shows the distribution of basic WASH services across all countries in the most recent year.
# Create bar chart
latest_data |>
summarise(
Water = mean(water_basic_total, na.rm = TRUE),
Sanitation = mean(sanitation_basic_total, na.rm = TRUE),
Hygiene = mean(hygiene_basic_total, na.rm = TRUE)
) |>
pivot_longer(everything(), names_to = "Service", values_to = "Percentage") |>
ggplot(aes(x = Service, y = Percentage, fill = Service)) +
geom_col() +
geom_text(aes(label = paste0(round(Percentage, 1), "%")),
vjust = -0.5, size = 5) +
scale_fill_manual(values = c("#2E86AB", "#A23B72", "#F18F01")) +
labs(
title = "Global Average: Schools with Basic WASH Services",
x = NULL,
y = "Percentage of Schools (%)"
) +
theme_minimal() +
theme(legend.position = "none",
text = element_text(size = 12)) +
ylim(0, 100)
Regional Comparison
Different regions show varying levels of WASH service coverage. Table 1 presents the average coverage by region.
# Regional summary
regional_summary <- latest_data |>
filter(!is.na(sdg_region)) |>
group_by(sdg_region) |>
summarise(
n_countries = n(),
water = mean(water_basic_total, na.rm = TRUE),
sanitation = mean(sanitation_basic_total, na.rm = TRUE),
hygiene = mean(hygiene_basic_total, na.rm = TRUE)
) |>
arrange(desc(water))
regional_summary |>
gt() |>
tab_header(
title = "Basic WASH Services by Region",
subtitle = "Percentage of schools with basic services (latest year)"
) |>
cols_label(
sdg_region = "Region",
n_countries = "Countries",
water = "Water",
sanitation = "Sanitation",
hygiene = "Hygiene"
) |>
fmt_number(
columns = c(water, sanitation, hygiene),
decimals = 1
) |>
tab_style(
style = cell_fill(color = "#E8F4F8"),
locations = cells_body(columns = everything())
)| Basic WASH Services by Region | ||||
| Percentage of schools with basic services (latest year) | ||||
| Region | Countries | Water | Sanitation | Hygiene |
|---|---|---|---|---|
| Europe and Northern America | 39 | 91.1 | 76.4 | 83.9 |
| Latin America and the Caribbean | 36 | 78.1 | 80.1 | 70.8 |
| Northern Africa and Western Asia | 23 | 77.6 | 85.1 | 70.8 |
| Oceania | 15 | 71.1 | 72.2 | 72.4 |
| Eastern and South-Eastern Asia | 16 | 70.9 | 65.2 | 70.4 |
| Central and Southern Asia | 13 | 70.4 | 68.4 | 62.2 |
| Sub-Saharan Africa | 48 | 56.5 | 51.5 | 45.8 |
| 0 | 414 | NaN | NaN | NaN |
| Australia and New Zealand | 1 | NaN | NaN | NaN |
Figure 2 visualizes regional differences in access to basic water services.
regional_summary |>
ggplot(aes(x = reorder(sdg_region, water), y = water)) +
geom_col(fill = "#2E86AB") +
geom_text(aes(label = paste0(round(water, 1), "%")),
hjust = -0.2, size = 3) +
coord_flip() +
labs(
title = "Schools with Basic Water Services by Region",
x = NULL,
y = "Percentage (%)"
) +
theme_minimal() +
theme(text = element_text(size = 11)) +
ylim(0, 100)
Urban vs Rural Disparities
Access to WASH services often differs between urban and rural schools.
# Calculate urban-rural gap
urban_rural_gap <- latest_data |>
summarise(
water_urban = mean(water_basic_urban, na.rm = TRUE),
water_rural = mean(water_basic_rural, na.rm = TRUE),
sanitation_urban = mean(sanitation_basic_urban, na.rm = TRUE),
sanitation_rural = mean(sanitation_basic_rural, na.rm = TRUE),
hygiene_urban = mean(hygiene_basic_urban, na.rm = TRUE),
hygiene_rural = mean(hygiene_basic_rural, na.rm = TRUE)
) |>
pivot_longer(everything(), names_to = "variable", values_to = "value") |>
separate(variable, into = c("service", "location"), sep = "_(?=urban|rural)") |>
pivot_wider(names_from = location, values_from = value) |>
mutate(gap = urban - rural)
urban_rural_gap |>
kable(
col.names = c("Service", "Urban (%)", "Rural (%)", "Gap (%)"),
digits = 1,
caption = "Urban-rural disparities in WASH services"
)| Service | Urban (%) | Rural (%) | Gap (%) |
|---|---|---|---|
| water | 76.5 | 62.2 | 14.3 |
| sanitation | 76.2 | 57.6 | 18.6 |
| hygiene | 59.7 | 41.0 | 18.7 |
Figure 3 illustrates the urban-rural gap across all three WASH services.
urban_rural_gap |>
select(-gap) |>
pivot_longer(c(urban, rural), names_to = "location", values_to = "percentage") |>
mutate(service = str_to_title(service),
location = str_to_title(location)) |>
ggplot(aes(x = service, y = percentage, fill = location)) +
geom_col(position = "dodge") +
geom_text(aes(label = paste0(round(percentage, 1), "%")),
position = position_dodge(width = 0.9),
vjust = -0.5, size = 3.5) +
scale_fill_manual(values = c("#2E86AB", "#F18F01")) +
labs(
title = "Urban vs Rural Schools: Basic WASH Services",
x = NULL,
y = "Percentage of Schools (%)",
fill = "Location"
) +
theme_minimal() +
theme(text = element_text(size = 12),
legend.position = "top") +
ylim(0, 100)
Conclusions
This analysis reveals several important findings about WASH services in schools:
Global coverage varies significantly across the three services, with water having the highest coverage and hygiene facilities having the lowest.
Regional disparities are substantial, with some regions having near-universal coverage while others lag significantly behind.
Urban schools consistently outperform rural schools across all three WASH services, highlighting the need for targeted interventions in rural areas.
These findings underscore the importance of continued investment in school WASH infrastructure, particularly in rural areas and lower-performing regions. Ensuring access to basic WASH services in schools is crucial for children’s health, educational outcomes, and overall development.