An open API service indexing awesome lists of open source software.

https://github.com/openwashdata/chckapmalawi

This packages compiles insights from a Knowledge, Attitudes, and Practices (KAP) Survey conducted by BASEflow for Waste Advisers in Malawi, focusing on Community Health Centers (CHCs).
https://github.com/openwashdata/chckapmalawi

Last synced: 4 months ago
JSON representation

This packages compiles insights from a Knowledge, Attitudes, and Practices (KAP) Survey conducted by BASEflow for Waste Advisers in Malawi, focusing on Community Health Centers (CHCs).

Awesome Lists containing this project

README

          

---
output: github_document

---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)

library(tidyverse)
library(epoxy)
library(leaflet)
library(chckapmalawi)
```

# chckapmalawi

[![DOI](https://zenodo.org/badge/709679915.svg)](https://zenodo.org/doi/10.5281/zenodo.10459432)
[![R-CMD-check](https://github.com/openwashdata/chckapmalawi/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/openwashdata/chckapmalawi/actions/workflows/R-CMD-check.yaml)

This packages compiles insights from a Knowledge, Attitudes, and Practices (KAP) Survey conducted by [BASEflow](https://baseflowmw.org/) for Waste Advisers in Malawi, focusing on Community Health Centers (CHCs).

## Installation

You can install the development version of chckapmalawi from [GitHub](https://github.com/) with:

``` r
# install.packages("devtools")
devtools::install_github("openwashdata/chckapmalawi")
```
Alternatively, you can download the individual dataset as a CSV or XLSX
file from the table below.

```{r, echo=FALSE}
library(dplyr)
library(stringr)
library(readr)

extdata_path <- "https://github.com/openwashdata/chckapmalawi/raw/main/inst/extdata/"

read_csv("data-raw/dictionary.csv", col_types = cols(.default = "c")) |>
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(show_col_types = FALSE)

```

## Project goal

## Data

The data set covers diverse aspects including household demographics, CHC membership, water sources, sanitation, nutrition knowledge, hygiene practices, and environmental conditions. It was collected in 20XX.

The package provides access to a single data sets.

```{r, echo = TRUE}
library(chckapmalawi)
```

The `chckapmalawi` data set has `r ncol(chckapmalawi)`
variables and `r nrow(chckapmalawi)` observations. For an overview
of the variable names, see the following table.

```{r, eval=FALSE}
chckapmalawi
```

```{r, echo=FALSE}
readr::read_csv("data-raw/dictionary.csv", col_types = cols(.default = "c")) |>
dplyr::filter(file_name == "chckapmalawi.rda") |>
dplyr::select(variable_name:description) |>
knitr::kable()
```

## Example

### Visualizing Vegetable Distribution in Malawi Gardens
This code snippet utilizes rAmCharts4 in R to visualize vegetable diversity in Malawian gardens. By displaying the distribution of crops grown, it highlights how Malawians can self-provide a diverse range of vegetables, crucial for a balanced diet.
```{r}
library(dplyr)
library(tidyr)
library(rAmCharts4)

chckapmalawi$vegetables_grown_in_garden <- gsub("Other \\(please specify\\)", "Other", chckapmalawi$vegetables_grown_in_garden)

split_data <- chckapmalawi |>
separate_rows(vegetables_grown_in_garden, sep = ",\\s*") |>
mutate(vegetables_grown_in_garden = trimws(vegetables_grown_in_garden)) |>
filter(vegetables_grown_in_garden != "")

vegetable_freq <- table(split_data$vegetables_grown_in_garden)
vegetable_freq_df <- as.data.frame(vegetable_freq)
names(vegetable_freq_df) <- c("Vegetable", "Frequency")

vegetable_freq_df$Percentage <- vegetable_freq_df$Frequency / sum(vegetable_freq_df$Frequency) * 100

chart <- amPieChart(
data = vegetable_freq_df,
category = "Vegetable",
value = "Frequency",
depth = 30,
legend = FALSE,
chartTitle = "Vegetables Grown in Garden (Malawi)",
animated = 1,
theme = "spiritedaway"
)
```
```{r, echo=FALSE, fig.cap="Screenshot of an interactive pie chart with rAmCharts4", out.width='75%'}
knitr::include_graphics("man/figures/vegetables_plot.png")
```

## License

Data are available as
[CC-BY](https://github.com/openwashdata/basisghana/LICENSE.md).

## Citation

To cite this package, please use:

```{r}
citation("chckapmalawi")
```