basisghana
This package compiles sanitation data from established Open Defecation Free (ODF) communities across different regions in Ghana.
Science Score: 67.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 1 DOI reference(s) in README -
✓Academic publication links
Links to: zenodo.org -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (8.2%) to scientific vocabulary
Keywords
defecation
ghana
open-data
openwashdata
r
sanitation
wash
Last synced: 6 months ago
·
JSON representation
·
Repository
This package compiles sanitation data from established Open Defecation Free (ODF) communities across different regions in Ghana.
Basic Info
- Host: GitHub
- Owner: openwashdata
- License: cc-by-4.0
- Language: R
- Default Branch: main
- Homepage: https://openwashdata.github.io/basisghana/
- Size: 2.02 MB
Statistics
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
- Releases: 2
Topics
defecation
ghana
open-data
openwashdata
r
sanitation
wash
Created over 2 years ago
· Last pushed about 2 years ago
Metadata Files
Readme
License
Citation
README.Rmd
---
output: github_document
editor_options:
chunk_output_type: console
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%",
message = FALSE,
warning = FALSE,
fig.retina = 2,
fig.align = 'center'
)
library(tidyverse)
library(epoxy)
library(universityrankingafrica)
```
# basisghana
[](https://github.com/openwashdata/basisghana/actions/workflows/R-CMD-check.yaml)
[](https://zenodo.org/doi/10.5281/zenodo.10255444)
This package compiles sanitation data from established Open Defecation Free (ODF) communities across different regions in Ghana.
```{r, echo=FALSE}
library(sf)
library(rnaturalearth)
library(ggplot2)
library(tidyverse)
library(basisghana)
library(dplyr)
basisghananew <- basisghana |>
rename(district_en = "district") |>
mutate(district_en = case_when(
district_en == "Abura Asebu Kwamankes" ~ "Abura-Asebu-Kwamankese",
district_en == "Ajumako Enyan Essiam" ~ "Ajumako-Enyan-Essiam",
district_en == "Asikuma Odoben Brakwa" ~ "Asikuma-Odoben-Brakwa",
district_en == "Bawku" ~ "Bawku Municipal",
district_en == "Bunkpurugu" ~ "Bunkpurugu Nakpanduri",
district_en == "Daffiama Bussie Iss" ~ "Daffiama Bussie Issa",
district_en == "East Gonja" ~ "East Gonja Municipal",
district_en == "Garu Tempane" ~ "Garu",
district_en == "Ho" ~ "Ho Municipal",
district_en == "Hohoe" ~ "Hohoe Municipal",
district_en == "Keta" ~ "Keta Municipal",
district_en == "Kpando Municipa" ~ "Kpando Municipal",
district_en == "Lambussie Karni" ~ "Lambussie-Karni",
district_en == "Nadowli Kaleo" ~ "Nadowli-Kaleo",
district_en == "Sagnarigu" ~ "Sagnerigu",
district_en == "Tatale" ~ "Tatale Sanguli",
district_en == "West Mamprusi" ~ "West Mamprusi Municipal",
district_en == "Yendi" ~ "Yendi Municipal",
district_en == "Damongo" ~ "West Gonja",
TRUE ~ district_en
))
odf_by_district <- basisghananew |>
group_by(district_en) |>
summarize(odf_population = sum(population, na.rm = TRUE))
odf_by_district <- merge(odf_by_district, ghanapop, by = 'district_en', all = TRUE) |>
mutate(percentage = round(odf_population / total_pop * 100, 2)) |>
arrange(desc(percentage))
top_10_odf <- odf_by_district |>
top_n(10, percentage) |>
select(district_en, region_en, percentage) |>
mutate(percentage = paste0(percentage, "%")) |>
rename(
district = "district_en",
region = "region_en",
`proportion ODF population in district` = "percentage"
)
#group the regions according to how they were back in 2017 (10 regions instead of 16)
odf_by_region <- odf_by_district |>
mutate(region_en = case_when(
region_en %in% c("Bono", "Bono East", "Ahafo") ~ "Brong Ahafo",
region_en %in% c("Northern", "Savannah", "Northern East") ~ "Northern",
region_en %in% c("Volta", "Oti") ~ "Volta",
region_en %in% c("Western", "Western North") ~ "Western",
TRUE ~ as.character(region_en)
)) |>
group_by(region_en) |>
summarize(
odf_population = sum(odf_population, na.rm = TRUE),
female = sum(female_pop, na.rm = TRUE),
male = sum(male_pop, na.rm = TRUE),
total_pop = sum(total_pop, na.rm = TRUE)
) |>
mutate(percentage = round(odf_population / total_pop * 100, 2)) |>
arrange(desc(percentage)) |>
filter(!is.na(region_en)) |>
select(region_en, percentage)
ghana <- ne_states(country = "Ghana", returnclass = "sf") |>
rename(
region_en = "name"
)
ggplot() +
theme_void() +
geom_sf(data = full_join(ghana, odf_by_region, by = "region_en"), aes(fill = percentage), color = "white", lwd = 0) +
scale_fill_gradientn(name = paste("Percentage of ODF population", "\n by region (logarithmic scale)"),
trans = "log",
labels = scales::label_number(accuracy = 1),
colors = c("#2E8B57","#9DBF9E", "#FCB97D", "#A84268"),
na.value = "grey80") +
labs(title = paste("Regions with highest percentage of ODF communities", "\n in Ghana (2017)")) +
theme_minimal() +
theme(
plot.title = element_text(size = 14),
plot.margin = margin(1, 1, 1, 1, "cm")
)
```
## Installation
You can install the development version of basisghana from [GitHub](https://github.com/) with:
``` r
# install.packages("devtools")
devtools::install_github("openwashdata/basisghana")
```
Alternatively, you can download the individual dataset as a CSV or XLSX
file from the table below.
```{r, echo=FALSE}
extdata_path <- "https://github.com/openwashdata/basisghana/raw/main/inst/extdata/"
read_csv("data-raw/dictionary.csv") |>
distinct(file_name) |>
mutate(file_name = str_remove(file_name, ".rda")) |>
rename(dataset = file_name) |>
mutate(
CSV = paste0("[Download CSV](", extdata_path, dataset, ".csv)"),
XLSX = paste0("[Download XLSX](", extdata_path, dataset, ".xlsx)")
) |>
knitr::kable()
```
## Project goal
The primary goal of BaSIS (Basic Sanitation Information System) within the context of implementing Community-Led Total Sanitation (CLTS) in Ghana is to combat open defecation. By collecting data on communities practicing open defecation, the project aims to shift away from previous subsidy-based approaches and focus on community engagement. BaSIS seeks to empower communities, particularly in regions like Upper West, Eastern, Northern, Volta, and Central, to abandon open defecation practices through CLTS. The objective is to break the cycle of fecal-oral contamination, reduce the spread of diseases linked to poor sanitation, and promote sustainable, community-driven solutions to improve overall hygiene and sanitation practices.
## Data
The data set includes the locations of the existing open defecation free (ODF) communities in
various districts of Ghana. It was last updated in September 2017.
The package provides access to two data sets.
```{r, echo = TRUE}
library(basisghana)
```
The `basisghana` data set has `r ncol(basisghana)`
variables and `r nrow(basisghana)` observations. For an overview
of the variable names, see the following table.
```{r, eval=FALSE}
basisghana
```
```{r, echo=FALSE}
readr::read_csv("data-raw/dictionary.csv") |>
dplyr::filter(file_name == "basisghana.rda") |>
dplyr::select(variable_name:description) |>
knitr::kable()
```
The `ghanapop` data set has `r ncol(ghanapop)`
variables and `r nrow(ghanapop)` observations. For an overview
of the variable names, see the following table.
```{r, eval=FALSE}
ghanapop
```
```{r, echo=FALSE}
readr::read_csv("data-raw/dictionary.csv") |>
dplyr::filter(file_name == "ghanapop.rda") |>
dplyr::select(variable_name:description) |>
knitr::kable()
```
## Example
```{r, echo=FALSE}
library(basisghana)
library(dplyr)
library(tidyverse)
basisghana <- basisghana |>
rename(district_en = "district") |>
mutate(district_en = case_when(
district_en == "Abura Asebu Kwamankes" ~ "Abura-Asebu-Kwamankese",
district_en == "Ajumako Enyan Essiam" ~ "Ajumako-Enyan-Essiam",
district_en == "Asikuma Odoben Brakwa" ~ "Asikuma-Odoben-Brakwa",
district_en == "Bawku" ~ "Bawku Municipal",
district_en == "Bunkpurugu" ~ "Bunkpurugu Nakpanduri",
district_en == "Daffiama Bussie Iss" ~ "Daffiama Bussie Issa",
district_en == "East Gonja" ~ "East Gonja Municipal",
district_en == "Garu Tempane" ~ "Garu",
district_en == "Ho" ~ "Ho Municipal",
district_en == "Hohoe" ~ "Hohoe Municipal",
district_en == "Keta" ~ "Keta Municipal",
district_en == "Kpando Municipa" ~ "Kpando Municipal",
district_en == "Lambussie Karni" ~ "Lambussie-Karni",
district_en == "Nadowli Kaleo" ~ "Nadowli-Kaleo",
district_en == "Sagnarigu" ~ "Sagnerigu",
district_en == "Tatale" ~ "Tatale Sanguli",
district_en == "West Mamprusi" ~ "West Mamprusi Municipal",
district_en == "Yendi" ~ "Yendi Municipal",
district_en == "Damongo" ~ "West Gonja",
TRUE ~ district_en
))
```
### 1) Extracting the Top 10 Districts with the Highest Percentage of ODF Communities in Ghana
The following code demonstrates how to calculate the percentage of ODF communities per region in Ghana. This computation involves using ODF population data sourced from the basisghana dataset, in conjunction with total population statistics categorized by region, sourced from the ghanapop dataset.
```{r example}
library(tidyverse)
library(basisghana)
library(dplyr)
odf_by_district <- basisghana |>
group_by(district_en) |>
summarize(odf_population = sum(population, na.rm = TRUE))
odf_by_district <- merge(odf_by_district, ghanapop, by = 'district_en', all = TRUE) |>
mutate(percentage = round(odf_population / total_pop * 100, 2)) |>
arrange(desc(percentage))
top_10_odf <- odf_by_district |>
top_n(10, percentage) |>
select(district_en, region_en, percentage) |>
mutate(percentage = paste0(percentage, "%")) |>
rename(
district = "district_en",
region = "region_en",
`proportion ODF population in district` = "percentage"
)
top_10_odf
```
### 2) Mapping the Regions with highest percentage of ODF communities in Ghana
The code uses the dataset of ODF communities categorized by districts (see above), which are then aggregated based on regions in Ghana. It's important to note that the reference to Ghana's regions pertains to the former 10 regions preceding the 2018 referendum, which subsequently led to the establishment of new regions, resulting in a total of 16 regions from 2020 (Refer to [Regions of Ghana](https://en.wikipedia.org/wiki/Regions_of_Ghana)). From the collected data across 5 of these former regions, a color-coded map of Ghana depicts the varying proportions of Open Defecation Free (ODF) communities in each region.
```{r}
library(sf)
library(rnaturalearth)
library(ggplot2)
#group the regions according to how they were back in 2017 (10 regions instead of 16)
odf_by_region <- odf_by_district |>
mutate(region_en = case_when(
region_en %in% c("Bono", "Bono East", "Ahafo") ~ "Brong Ahafo",
region_en %in% c("Northern", "Savannah", "Northern East") ~ "Northern",
region_en %in% c("Volta", "Oti") ~ "Volta",
region_en %in% c("Western", "Western North") ~ "Western",
TRUE ~ as.character(region_en)
)) |>
group_by(region_en) |>
summarize(
odf_population = sum(odf_population, na.rm = TRUE),
female = sum(female_pop, na.rm = TRUE),
male = sum(male_pop, na.rm = TRUE),
total_pop = sum(total_pop, na.rm = TRUE)
) |>
mutate(percentage = round(odf_population / total_pop * 100, 2)) |>
arrange(desc(percentage)) |>
filter(!is.na(region_en)) |>
select(region_en, percentage)
ghana <- ne_states(country = "Ghana", returnclass = "sf") |>
rename(
region_en = "name"
)
ggplot() +
theme_void() +
geom_sf(data = full_join(ghana, odf_by_region, by = "region_en"), aes(fill = percentage), color = "white", lwd = 0) +
scale_fill_gradientn(name = paste("Percentage of ODF population", "\n by region (logarithmic scale)"),
trans = "log",
labels = scales::label_number(accuracy = 1),
colors = c("#2E8B57","#9DBF9E", "#FCB97D", "#A84268"),
na.value = "grey80") +
labs(title = paste("Regions with highest percentage of ODF communities", "\n in Ghana (2017)")) +
theme_minimal() +
theme(
plot.title = element_text(size = 14),
plot.margin = margin(1, 1, 1, 1, "cm")
)
```
*Note: A logarithmic scale has been employed to accentuate distinctions among lower percentage values.*
## License
Data are available as
[CC-BY](https://github.com/openwashdata/basisghana/LICENSE.md).
## Citation
To cite this package, please use:
```{r}
citation("basisghana")
```
Owner
- Name: openwashdata
- Login: openwashdata
- Kind: organization
- Repositories: 1
- Profile: https://github.com/openwashdata
Citation (CITATION.cff)
# -----------------------------------------------------------
# CITATION file created with {cffr} R package, v0.5.0
# See also: https://docs.ropensci.org/cffr/
# -----------------------------------------------------------
cff-version: 1.2.0
message: 'To cite package "basisghana" in publications use:'
type: software
license: CC-BY-4.0
title: 'basisghana: Basic Sanitation Information System - BaSIS'
version: 0.0.0.9000
abstract: This package compiles sanitation data from established Open Defecation Free
(ODF) communities across different regions in Ghana.
authors:
- family-names: Schöbitz
given-names: Lars
email: lschoebitz@ethz.ch
orcid: https://orcid.org/0000-0003-2196-5015
- family-names: Skorik
given-names: Sophia
email: sskorik@ethz.ch
orcid: https://orcid.org/0009-0001-4755-1649
date-released: '2023-12-04'
contact:
- family-names: Schöbitz
given-names: Lars
email: lschoebitz@ethz.ch
orcid: https://orcid.org/0000-0003-2196-5015
- family-names: Skorik
given-names: Sophia
email: sskorik@ethz.ch
orcid: https://orcid.org/0009-0001-4755-1649
GitHub Events
Total
Last Year
Dependencies
DESCRIPTION
cran
- R >= 2.10 depends
.github/workflows/R-CMD-check.yaml
actions
- actions/checkout v3 composite
- r-lib/actions/check-r-package v2 composite
- r-lib/actions/setup-pandoc v2 composite
- r-lib/actions/setup-r v2 composite
- r-lib/actions/setup-r-dependencies v2 composite