wsabrazil

This dataset about wastewater management and household infrastructure from various Brazilian regions provides insights into wastewater disposal habits, water sources, bathroom facilities, and sanitation infrastructure.

https://github.com/openwashdata/wsabrazil

Science Score: 44.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
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.4%) to scientific vocabulary

Keywords

2010 brazil infrastructure open-data r sanitation wash wastewater water
Last synced: 6 months ago · JSON representation ·

Repository

This dataset about wastewater management and household infrastructure from various Brazilian regions provides insights into wastewater disposal habits, water sources, bathroom facilities, and sanitation infrastructure.

Basic Info
Statistics
  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • Open Issues: 1
  • Releases: 0
Topics
2010 brazil infrastructure open-data r sanitation wash wastewater water
Created almost 2 years ago · Last pushed about 1 year ago
Metadata Files
Readme License Citation

README.Rmd

---
output: github_document
always_allow_html: true
editor_options: 
  markdown: 
    wrap: 72
  chunk_output_type: console
bibliography: references.bib
---



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

library(tidyverse)
```

# wsabrazil


[![License: CC BY 4.0](https://img.shields.io/badge/License-CC_BY_4.0-darkorange.svg)](https://creativecommons.org/licenses/by/4.0/)
[![R-CMD-check](https://github.com/openwashdata/wsabrazil/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/openwashdata/wsabrazil/actions/workflows/R-CMD-check.yaml)


This package contains information related to wastewater management practices and household infrastructure in Brazil. It includes variables such as sector codes, metropolitan region names, municipality codes, and names, as well as data on the location type, living conditions, average income, and household amenities. The data provides insights into wastewater disposal habits, water supply sources, bathroom facilities, and sanitation infrastructure in Brazilian households, contributing to understanding environmental sustainability and infrastructure development efforts. @atlas
![](man/figures/Rplot04.png)
Based on the data, it appears for example that most of the municipalities exhibits poor housing conditions. In this dataset, housing conditions are represented numerically, with '1' indicating correct housing conditions and '0' indicating poor housing conditions. The location map displays all Brazilian municipalities from which data has been collected.

## Installation

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

```r
# install.packages("devtools")
devtools::install_github("openwashdata/wsabrazil")
```

Alternatively, you can download the dataset as a CSV or XLSX
file from the table below.

```{r, echo=FALSE, message=FALSE, warning=FALSE}

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

read_csv("data-raw/dictionary.csv") |> 
  distinct(file_name) |> 
  dplyr::mutate(file_name = str_remove(file_name, ".rda")) |> 
  dplyr::rename(dataset = file_name) |> 
  mutate(
    CSV = paste0("[Download CSV](", extdata_path, dataset, ".csv)"),
    XLSX = paste0("[Download XLSX](", extdata_path, dataset, ".xlsx)")
  ) |> 
  knitr::kable()

```

## Data

The dataset includes observations of wastewater management practices and household infrastructure (access to water and sanitation services) across various regions in Brazil.

The package provides access to one single dataset.

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

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

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

```{r, echo=FALSE, message=FALSE, warning=FALSE}
readr::read_csv("data-raw/dictionary.csv") |> 
  dplyr::filter(file_name == "wsabrazil.rda") |> 
  dplyr::select(variable_name:description) |> 
  knitr::kable() |> 
  kableExtra::kable_styling() |> 
  kableExtra::scroll_box(height = "400px")
```

## Examples

### 1. Housing conditions across municipalities

The location map displayed above was created as follows:

```{r eval=FALSE, message=FALSE, warning=FALSE, include=TRUE, paged.print=FALSE}
library(wsabrazil)
library(ggplot2)
library(sf)
library(dplyr)

shapefile <- st_read("man/gadm41_BRA_2.json")
merged_data <- merge(shapefile, wsabrazil, by.x = "CC_2", by.y = "municipality_code")

# Plot the choropleth map
ggplot() +
  geom_sf(data = merged_data, aes(fill = as.factor(sector_type))) +
  scale_fill_manual(name = "sector_type", values = c("0" = "#E69F00", "1" = "#0072B2"),
                    labels = c("0" = "poor", "1" = "correct")) +
  labs(title = "Housing conditions across municipalities") +
  theme(plot.title = element_text(hjust = 0.5, face = "bold", color = "#333333", size = 24),
        legend.title = element_text(face = "bold", color = "#333333", size = 16),
        legend.text = element_text(color = "#333333", size = 16))
```

### 2. Water supply in Brazil

From the dataset, we can also explore the distribution of water sources in the whole country. We create here a horizontal bar plot to visualize the frequency of different water sources available, utilizing variables such as piped water or stored rainwater. We observe from the resulting plot (see Figure below) that the majority of private households are supplied by piped water. Interestingly, almost none of the households store rainwater. This is possibly due to factors such as local climate patterns and infrastructure limitations.

```{r, eval=FALSE}
library(dplyr)
library(ggplot2)
library(wsabrazil)
library(tidyr)

data_long_summary <- wsabrazil |> 
  pivot_longer(cols = piped_water:other_water_source, 
                      names_to = "water_source", 
                      values_to = "frequency") |> 
  group_by(water_source) |> 
  summarise(total_frequency = sum(frequency, na.rm = TRUE)) |> 
  arrange(total_frequency)

# Create a horizontal bar plot of water source types
plot <- ggplot(data_long_summary, aes(x = total_frequency, y = reorder(water_source, total_frequency))) +
  geom_col(fill = "#0072B2") +
  labs(x = "Frequency", y = "Water Source", 
       title = "Water supply in Brazil", 
       caption = "") +
  theme(plot.title = element_text(hjust = 0.5, face = "bold", color = "#333333"))

plot + scale_x_continuous(labels = scales::number_format())

```

![](man/figures/Rplot01.png)

## License

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

## Citation

To cite this package, please use:

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

## References

```{html, echo = FALSE}
```

Owner

  • Name: openwashdata
  • Login: openwashdata
  • Kind: organization

Citation (CITATION.cff)

# -----------------------------------------------------------
# CITATION file created with {cffr} R package, v1.0.0
# See also: https://docs.ropensci.org/cffr/
# -----------------------------------------------------------

cff-version: 1.2.0
message: 'To cite package "wsabrazil" in publications use:'
type: software
license: CC-BY-4.0
title: 'wsabrazil: Wastewater management and household infrastructure in     Brazil'
version: 0.0.0.9000
abstract: This dataset about wastewater management and household infrastructure from
  various Brazilian regions provides insights into wastewater disposal habits, water
  sources, bathroom facilities, and sanitation infrastructure.
authors:
- family-names: Götschmann
  given-names: Margaux
  email: margauxg@ethz.ch
  orcid: https://orcid.org/0009-0002-2567-3343
- family-names: Santos
  given-names: Lais
  email: laismoreira@gmail.com
  orcid: https://orcid.org/0000-0003-2898-7014
date-released: '2024-04-02'
contact:
- family-names: Götschmann
  given-names: Margaux
  email: margauxg@ethz.ch
  orcid: https://orcid.org/0009-0002-2567-3343

GitHub Events

Total
  • Push event: 1
Last Year
  • Push event: 1

Dependencies

.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v4 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
DESCRIPTION cran