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 1 hour 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 months ago

Total Commits: 1,329
Total Committers: 15
Avg Commits per committer: 88.6
Development Distribution Score (DDS): 0.637

Commits in past year: 583
Committers in past year: 7
Avg Commits per committer in past year: 83.286
Development Distribution Score (DDS) in past year: 0.484

Name Email Commits
Sierra Johnson s****2@b****m 483
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: about 1 month ago

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

Past year issues: 0
Past year pull requests: 10
Past year average time to close issues: N/A
Past year average time to close pull requests: about 3 hours
Past year issue authors: 0
Past year pull request authors: 3
Past year average comments per issue: 0
Past year average comments per pull request: 0.0
Past year merged pull request: 3
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)

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 7 months ago)
  • Last Synced: 2026-02-21T17:35:59.107Z (about 1 month ago)
  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 196 Last month
  • Rankings:
    • Dependent packages count: 27.836%
    • Dependent repos count: 34.321%
    • Average: 49.704%
    • Downloads: 86.957%
  • Maintainers (1)

Score: 11.249350467861682