tidywater

Incorporates published water chemistry and empirical models in a standard format to build custom, comprehensive drinking water treatment processes.
https://github.com/brownandcaldwell-public/tidywater

Category: Natural Resources
Sub Category: Water Supply and Quality

Keywords

chemistry drinking-water r-programming tidyverse water

Last synced: about 4 hours ago
JSON representation

Repository metadata

Tidywater incorporates published water chemistry and empirical models in a standard format. The modular functions allow for building custom, comprehensive drinking water treatment processes.

README.Rmd

          ---
output: github_document
---



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

# tidywater 


[![R-CMD-check](https://github.com/BrownandCaldwell-Public/tidywater/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/BrownandCaldwell-Public/tidywater/actions/workflows/R-CMD-check.yaml)
[![License:MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/BrownandCaldwell-Public/tidywater/tree/main?tab=License-2-ov-file#mit-license)
[![License:Apache 2.0](https://img.shields.io/badge/license-Apache%20License%202.0-blue)](https://github.com/BrownandCaldwell-Public/tidywater/tree/main?tab=License-2-ov-file#mit-license)


## Overview 

Tidywater incorporates published water chemistry and empirical models in a standard format.
The modular functions allow for building custom, comprehensive drinking water treatment processes. 
Functions are designed to work in a [tidyverse](https://www.tidyverse.org/) workflow. 

## Installation


``` r
# Install tidywater from CRAN:
install.packages("tidywater")

# Alternatively, install the development version from GitHub:
# install.packages("devtools")
devtools::install_github("BrownandCaldwell-Public/tidywater")
```

## Examples

In this first example, acid-base chemistry and TOC removal models are demonstrated. This example 
uses tidywater base functions to model a single water quality scenario.

```{r example, message = FALSE, setup = TRUE}
library(tidywater)
library(tidyverse)
## Use base tidywater functions to model water quality for a single scenario.
base_coagulation <- define_water(ph = 8, alk = 90, tds = 50, toc = 3, doc = 2.8, uv254 = 0.08) %>%
  # note that we get a warning about sulfate from this code because we didn't specify sulfate in the define_water
  chemdose_ph(alum = 30) %>%
  chemdose_toc(alum = 30)
```

To model multiple water quality scenarios, use tidywater's helper functions (x_df) to 
apply the models to a dataframe. The `pluck_cols` argument can be added to return the parameters impacted by the model
as separate columns. The `pluck_water` function can pull any parameter from a water into a separate column.

```{r}

coagulation <- water_df %>%
  define_water_df(output_water = "raw") %>%
  mutate(alum = 30) %>%
  chemdose_ph_df(input_water = "raw", output_water = "phchange") %>% # return "phchange" water
  chemdose_toc_df(input_water = "phchange", output_water = "coag", pluck_cols = TRUE) # return "coag" water and coag_doc, coag_toc, coag_uv254 as columns

## To get individual parameters, use `pluck_water`
coagulation <- coagulation %>%
  pluck_water(input_waters = c("raw", "coag"), parameter = c("ph", "doc"))
```

Note that these functions use a "water" class. The "water" class is the foundation of the package; 
it provides a mechanism for linking models in any order while maintaining water quality information.
The `define_water` function takes water quality inputs, but `define_water_df` may be used to convert
a dataframe to a list of "waters".

For more detailed examples on tidywater functions and how to use "water" class data, please see 
the tidywater vignettes: `browseVignettes("tidywater")`

## Limitations
This project is maintained by volunteers and is provided without warranties or guarantees of any kind.  

Use at your own risk. For official support, please contact Brown and Caldwell. 

Please read our CONTRIBUTING.md and SECURITY.md before submitting issues or pull requests. 

        

Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 2 days ago

Total Commits: 1,331
Total Committers: 15
Avg Commits per committer: 88.733
Development Distribution Score (DDS): 0.636

Commits in past year: 464
Committers in past year: 6
Avg Commits per committer in past year: 77.333
Development Distribution Score (DDS) in past year: 0.351

Name Email Commits
Sierra Johnson s****2@b****m 485
Libby McKenna l****a@g****m 408
Jiaming Yuan j****n@b****m 301
Riley E. Mulhern r****n@b****m 50
rmerrifield1 r****d@b****m 21
phoebechen19 p****n@b****m 18
bengukilinc b****c@b****m 12
Hzanib 1****b 11
Riley E. Mulhern 1****n 9
mayushiva1707 M****m@B****m 4
carter c****r@s****m 4
Chris Somerlot c****t@b****m 3
Carter C****s@m****m 3
awohlgemuth a****h@b****m 1
Chris Somerlot c****t@b****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: 10 days ago

Total issues: 3
Total pull requests: 16
Average time to close issues: N/A
Average time to close pull requests: about 1 month
Total issue authors: 2
Total pull request authors: 4
Average comments per issue: 0.33
Average comments per pull request: 0.25
Merged pull request: 7
Bot issues: 0
Bot pull requests: 0

Past year issues: 1
Past year pull requests: 9
Past year average time to close issues: N/A
Past year average time to close pull requests: about 4 hours
Past year issue authors: 1
Past year pull request authors: 3
Past year average comments per issue: 1.0
Past year average comments per pull request: 0.0
Past year merged pull request: 2
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/brownandcaldwell-public/tidywater

Top Issue Authors

  • Carter12s (2)
  • libbymckenna (1)

Top Pull Request Authors

  • sierrajohnson (10)
  • Carter12s (3)
  • csomerlot (2)
  • libbymckenna (1)

Top Issue Labels

Top Pull Request Labels

  • enhancement (1)

Package metadata

cran.r-project.org: tidywater

Water Quality Models for Drinking Water Treatment Processes

  • Homepage: https://github.com/BrownandCaldwell-Public/tidywater
  • Documentation: http://cran.r-project.org/web/packages/tidywater/tidywater.pdf
  • Licenses: Apache License (≥ 2) | MIT + file LICENSE
  • Latest release: 0.10.0 (published 8 months ago)
  • Last Synced: 2026-04-24T17:00:26.778Z (2 days ago)
  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 272 Last month
  • Rankings:
    • Dependent packages count: 27.836%
    • Dependent repos count: 34.321%
    • Average: 49.704%
    • Downloads: 86.957%
  • Maintainers (1)

Dependencies

.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
.github/workflows/dependencies-scan.yaml actions
  • actions/checkout v4 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/gitleaks.yaml actions
  • actions/checkout v4 composite
  • gitleaks/gitleaks-action v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v4 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
DESCRIPTION cran
  • R >= 2.10 depends
  • dplyr * imports
  • furrr * imports
  • ggplot2 * imports
  • ggrepel * imports
  • knitr * imports
  • magrittr * imports
  • methods * imports
  • purrr * imports
  • rlang * imports
  • tidyr * imports
  • rmarkdown * suggests
  • testthat >= 3.0.0 suggests

Score: 11.684817826273644