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

https://github.com/openwashdata/glaas

UN-Water Global Analysis and Assessment of Sanitation and Drinking-water
https://github.com/openwashdata/glaas

glaas r rpackage wash

Last synced: 4 months ago
JSON representation

UN-Water Global Analysis and Assessment of Sanitation and Drinking-water

Awesome Lists containing this project

README

          

---
output: github_document
always_allow_html: true
editor_options:
markdown:
wrap: 72
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(desc)
library(dplyr)
library(readr)
library(gt)
library(kableExtra)
library(fontawesome)

package <- desc::desc_get_field("Package")
organisation <- desc::desc_get_field("Organisation") # Assuming you have an 'Organisation' field in DESCRIPTION
organisation_package <- paste0(organisation, "/", package)
browser_favicon_colour <- "lightblue"

# Conditionally install and load the package
if (!requireNamespace(package, quietly = TRUE)) {
devtools::install_github(organisation_package, dependencies = TRUE, upgrade = "never")
}
library(package, character.only = TRUE)

# Assuming main dataset is also named after the package
data(list = package, package = package)

```

# `r desc::desc_get_field("Package")`
***`r desc::desc_get_field("Title")`***

[![License: CC BY
4.0](https://img.shields.io/badge/License-CC_BY_4.0-lightgrey.svg)](https://creativecommons.org/licenses/by/4.0/)

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.15497462.svg)](https://zenodo.org/doi/10.5281/zenodo.15497462)

`r desc::desc_get_field("Description")`

-----

## Installation

You can install the development version of ``r desc::desc_get_field("Package")`` from GitHub `r fontawesome::fa("github")` with:

``` r
devtools::install_github("`r organisation_package`", dependencies = TRUE)
```

-----

### Download as CSV Files

If you prefer to work with the data outside of R, you can download individual datasets as CSV files.

1. **Right-click** on the "Download CSV" link for the dataset you want.
2. Select **"Save Link As"** [`r fontawesome::fa("chrome", fill = browser_favicon_colour)`](https://www.google.com/chrome/) [`r fontawesome::fa("edge", fill = browser_favicon_colour)`](https://www.microsoft.com/edge/) [`r fontawesome::fa("firefox", fill = browser_favicon_colour)`](https://www.mozilla.org/firefox/) or **"Download Linked File"** [`r fontawesome::fa("safari", fill = browser_favicon_colour)`](https://www.apple.com/safari/).
3. Choose where you'd like to save the file on your computer.

\n

```{r, echo=FALSE, message=FALSE, warning=FALSE}
extdata_path <- c(paste0(desc::desc_get_field("URL"), "/raw/main/inst/extdata/"))

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

```

\n\n

## Data
``` r
library(`r package`)
```

### glaas

The dataset ``r desc::desc_get_field("Package")`` has `r nrow(get(desc::desc_get_field("Package")))` observations and `r ncol(get(desc::desc_get_field("Package")))` variables

``` r
get(`r package`) |>
head(3) |>
gt::gt() |>
gt::as_raw_html()
```

```{r, echo=FALSE, message=FALSE, warning=FALSE}
get(package) |>
head(3) |>
gt::gt() |>
gt::as_raw_html()
```

-----

For an overview of the variable names, see the following table.

```{r echo=FALSE, message=FALSE, warning=FALSE}
readr::read_csv("data-raw/dictionary.csv") |>
dplyr::filter(file_name == paste0(package, ".rda")) |>
dplyr::select(variable_name:description) |>
knitr::kable(booktabs = TRUE) |>
kableExtra::kable_styling(
full_width = FALSE,
bootstrap_options = c("striped"),
position = "center"
)
```

## License

Data are available as
[CC-BY](https://github.com/openwashdata/`r package`/blob/main/LICENSE.md).

## Citation

```{r, echo=FALSE, message=FALSE, warning=FALSE}
citation(package)
```