diff --git a/.Rbuildignore b/.Rbuildignore index 91fd81d..6536370 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -3,3 +3,4 @@ ^data-raw$ ^README\.Rmd$ ^LICENSE\.md$ +^\.github$ diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 0000000..2d19fc7 --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1 @@ +*.html diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml new file mode 100644 index 0000000..14159b7 --- /dev/null +++ b/.github/workflows/R-CMD-check.yaml @@ -0,0 +1,50 @@ +# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + +name: R-CMD-check + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - {os: macos-latest, r: 'release'} + - {os: windows-latest, r: 'release'} + - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'oldrel-1'} + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + + steps: + - uses: actions/checkout@v4 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check + + - uses: r-lib/actions/check-r-package@v2 + with: + upload-snapshots: true + build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")' diff --git a/README.Rmd b/README.Rmd index cfea6f9..a7e6944 100644 --- a/README.Rmd +++ b/README.Rmd @@ -25,12 +25,13 @@ library(tidyverse) [![License: CC BY 4.0](https://img.shields.io/badge/License-CC_BY_4.0-brown.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 from the year 2010 and across various regions 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 +This package contains information related to wastewater management practices and household infrastructure in the Metropolitan Region of Belém, 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/housingconditionsnotitle.png) -Based on the data, it appears for example that one of the municipalities exhibits poorer housing conditions compared to others. In this dataset, housing conditions are represented numerically, with '1' indicating correct housing conditions and '0' indicating poor housing conditions. +Based on the data, it appears for example that the municipality of Marituba exhibits poorer housing conditions compared to others. In this dataset, housing conditions are represented numerically, with '1' indicating correct housing conditions and '0' indicating poor housing conditions. The location map displays the Metropolitan Region of Belém. ## Installation @@ -63,7 +64,7 @@ read_csv("data-raw/dictionary.csv") |> ## Data The dataset includes observations of wastewater management practices and household infrastructure (access to water and sanitation services) across various regions in Brazil. - + The data was collected in 2010 and the package provides access to one single dataset. ```{r, echo = TRUE} @@ -107,6 +108,29 @@ ggplot() + theme(plot.title = element_text(hjust = 0.5, face = "bold")) ``` +From the dataset, we can explore the distribution of water sources in the Metropolitan Region of Belém. 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, 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) + +# Reshape the data into long format +data_long <- wsabrazil |> + tidyr::pivot_longer(cols = piped_water:other_water_source, + names_to = "water_source", + values_to = "frequency") + +# Create a horizontal bar plot of water source types +ggplot(data_long, aes(x = frequency, y = reorder(water_source, frequency))) + + geom_bar(stat = "identity", fill = "#3399FF") + + labs(x = "Frequency", y = "Water Source", + title = "Water Supply in Belém", + caption = "") + + theme(plot.title = element_text(hjust = 0.5, face = "bold", color = "#333333")) + +``` +![](man/figures/water_supply.png) + ## License Data are available as diff --git a/README.md b/README.md index af62036..78795d6 100644 --- a/README.md +++ b/README.md @@ -7,24 +7,26 @@ [![License: CC BY 4.0](https://img.shields.io/badge/License-CC_BY_4.0-brown.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 from the year 2010 and across -various regions 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 of the 2010 Demographic Census - PGI” (n.d.) +practices and household infrastructure in the Metropolitan Region of +Belém, 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 of the +2010 Demographic Census - PGI” (n.d.) ![](man/figures/housingconditionsnotitle.png) Based on the data, it -appears for example that one of the municipalities exhibits poorer +appears for example that the municipality of Marituba exhibits poorer housing conditions compared to others. In this dataset, housing conditions are represented numerically, with ‘1’ indicating correct -housing conditions and ‘0’ indicating poor housing conditions. +housing conditions and ‘0’ indicating poor housing conditions. The +location map displays the Metropolitan Region of Belém. ## Installation @@ -306,6 +308,37 @@ wastewater discharged into other outlet ## Example +From the dataset, we can explore the distribution of water sources in +the Metropolitan Region of Belém. 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, none of the +households store rainwater. This is possibly due to factors such as +local climate patterns and infrastructure limitations. + +``` r +library(dplyr) +library(ggplot2) +library(wsabrazil) + +# Reshape the data into long format +data_long <- wsabrazil |> + tidyr::pivot_longer(cols = piped_water:other_water_source, + names_to = "water_source", + values_to = "frequency") + +# Create a horizontal bar plot of water source types +ggplot(data_long, aes(x = frequency, y = reorder(water_source, frequency))) + + geom_bar(stat = "identity", fill = "#3399FF") + + labs(x = "Frequency", y = "Water Source", + title = "Water Supply in Belém", + caption = "") + + theme(plot.title = element_text(hjust = 0.5, face = "bold", color = "#333333")) +``` + +![](man/figures/water_supply.png) + ## License Data are available as @@ -319,16 +352,16 @@ To cite this package, please use: citation("wsabrazil") #> To cite package 'wsabrazil' in publications use: #> -#> Götschmann M, Santos L (2024). "wsabrazil: Waste management and +#> Götschmann M, Santos L (2024). "wsabrazil: Wastewater management and #> household infrastructure in Brazil - Demographic Census 2010." #> #> A BibTeX entry for LaTeX users is #> #> @Misc{gotschmann_etall:2024, -#> title = {wsabrazil: Waste management and household infrastructure in Brazil - Demographic Census 2010}, +#> title = {wsabrazil: Wastewater management and household infrastructure in Brazil - Demographic Census 2010}, #> author = {Margaux Götschmann and Lais Santos}, #> year = {2024}, -#> abstract = {This dataset about waste management and household infrastructure from various Brazilian regions provides insights into waste disposal habits, water sources, bathroom facilities, and sanitation infrastructure.}, +#> 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.}, #> version = {0.0.0.9000}, #> } ``` diff --git a/man/figures/water_supply.png b/man/figures/water_supply.png new file mode 100644 index 0000000..5799a26 Binary files /dev/null and b/man/figures/water_supply.png differ