Package: tidywater 0.10.9000

Sierra Johnson

tidywater: Water Quality Models for Drinking Water Treatment Processes

Provides multiple water chemistry-based models and published empirical models in one standard format. As many models have been included as possible, however, users should be aware that models have varying degrees of accuracy and applicability. To learn more, read the references provided below for the models implemented. Functions can be chained together to model a complete treatment process and are designed to work in a 'tidyverse' workflow. Models are primarily based on these sources: Benjamin, M. M. (2002, ISBN:147862308X), Crittenden, J. C., Trussell, R., Hand, D., Howe, J. K., & Tchobanoglous, G., Borchardt, J. H. (2012, ISBN:9781118131473), USEPA. (2001) <https://www.epa.gov/sites/default/files/2017-03/documents/wtp_model_v._2.0_manual_508.pdf>.

Authors:Sierra Johnson [aut, cre], Libby McKenna [aut], Riley Mulhern [aut], Chris Corwin [aut], Rachel Merrifield [ctb], Mayuri Namasivayam [ctb], Phoebe Chen [ctb], Jiaming Yuan [ctb], USEPA [cph], Brown and Caldwell [fnd, cph]

tidywater_0.10.9000.tar.gz
tidywater_0.10.9000.zip(r-4.7)tidywater_0.10.9000.zip(r-4.6)tidywater_0.10.9000.zip(r-4.5)
tidywater_0.10.9000.tgz(r-4.6-any)tidywater_0.10.9000.tgz(r-4.5-any)
tidywater_0.10.9000.tar.gz(r-4.7-any)tidywater_0.10.9000.tar.gz(r-4.6-any)
tidywater_0.10.9000.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
tidywater/json (API)

# Install 'tidywater' in R:
install.packages('tidywater', repos = c('https://brownandcaldwell-public.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/brownandcaldwell-public/tidywater/issues

Pkgdown/docs site:https://brownandcaldwell-public.github.io

Datasets:
  • bromatecoeffs - Data frame of bromate coefficients for predicting bromate formation during ozonation
  • chloramine_conv - Data frame of conversion factors for estimating DBP formation from chloramines
  • cl2coeffs - Data frame of Cl2 decay coefficients
  • dbp_correction - Data frame of correction factors for estimating DBP formation as a function of location
  • dbpcoeffs - Data frame of DBP coefficients for predicting DBP formation
  • discons - Dissociation constants and standard enthalpy for weak acids/bases
  • edwardscoeff - Data frame of Edwards model coefficients
  • leadsol_constants - Data frame of equilibrium constants for lead and copper solubility
  • mweights - Molar weights of relevant compounds
  • pactoccoeffs - Data frame of PAC TOC model coefficients
  • toc_compliance_table - Data frame of TOC removal requirements per Stage 1 DBP Rule
  • vlog_removalcts - Data frame of virus log removal CT values
  • water_df - Data frame of water quality parameters

On CRAN:

Conda:

chemistrydrinking-waterr-programmingtidyversewater

8.12 score 21 stars 30 scripts 276 downloads 95 exports 38 dependencies

Last updated from:a06e19846e. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK214
source / vignettesOK254
linux-release-x86_64OK215
macos-release-arm64OK203
macos-oldrel-arm64OK174
windows-develOK155
windows-releaseOK169
windows-oldrelOK155
wasm-releaseOK146

Exports:%>%balance_ionsbalance_ions_chainbalance_ions_dfbiofilter_tocbiofilter_toc_chainbiofilter_toc_dfblend_watersblend_waters_chainblend_waters_dfcalculate_activitycalculate_corrosioncalculate_corrosion_dfcalculate_corrosion_oncecalculate_hardnesschemdose_chloraminechemdose_chloramine_chainchemdose_chloramine_dfchemdose_chlordecaychemdose_chlordecay_chainchemdose_chlordecay_dfchemdose_dbpchemdose_dbp_chainchemdose_dbp_dfchemdose_dbp_oncechemdose_phchemdose_ph_chainchemdose_ph_dfchemdose_ph_oncechemdose_tocchemdose_toc_chainchemdose_toc_dfchemdose_toc_onceconvert_unitsconvert_waterconvert_watermgcorrect_kdecarbonate_phdecarbonate_ph_chaindecarbonate_ph_dfdefine_waterdefine_water_chaindefine_water_dfdefine_water_oncedissolve_cudissolve_cu_dfdissolve_cu_oncedissolve_pbdissolve_pb_dfdissolve_pb_oncegac_tocgac_toc_dfgacbv_tocgacbv_toc_dfgacrun_tocgacrun_toc_dfmodify_watermodify_water_chainmodify_water_dfopensys_phopensys_ph_dfozonate_bromateozonate_bromate_chainozonate_bromate_dfpac_tocpac_toc_chainpac_toc_dfplot_ionsplot_leadpluck_waterregulate_tocregulate_toc_dfsolvecost_chemsolvecost_laborsolvecost_powersolvecost_solidssolvect_chlorinesolvect_chlorine_dfsolvect_chlorine_oncesolvect_o3solvect_o3_dfsolvect_o3_oncesolvedose_alksolvedose_alk_dfsolvedose_alk_oncesolvedose_phsolvedose_ph_dfsolvedose_ph_oncesolvemass_chemsolvemass_solidssolveresid_o3solveresid_o3_dfsolveresid_o3_oncesummarise_wqsummarize_wq

Dependencies:clicpp11deSolvedplyrevaluatefarverforcatsgenericsggplot2ggrepelgluegtablehighrisobandknitrlabelinglifecyclemagrittrpillarpkgconfigpurrrR6RColorBrewerRcpprlangS7scalesstringistringrtibbletidyrtidyselectutf8vctrsviridisLitewithrxfunyaml

Fitting and using custom coefficients in chemdose_dbp
Water setup | Fitting DBP coefficients | Summary

Last update: 2025-08-28
Started: 2025-08-28

Getting started with tidywater
Defining an example water | Coagulation model | Disinfection model | Summary and Recommended Resources

Last update: 2025-08-28
Started: 2024-10-22

Blending Multiple Waters
Blending analysis setup | Well setup | Blending scenarios and finish source setup | Blending multiple sources | Summary

Last update: 2025-08-28
Started: 2024-10-22

Helper Functions & Dose Chemicals
Chemical dosing setup | Multi-scenario setup and intro to _df functions | chemdose_ph_df and pluck_water | solvedose_ph_df | Summary

Last update: 2025-08-28
Started: 2024-10-22

Introduction to tidywater: Basic functions
Getting started | Defining a water | Plotting and balancing ions | Converting units | Modelling assumptions | Ionic strength | Hardness | Total and dissolved organic carbon | Summary and Recommended Resources

Last update: 2025-07-07
Started: 2024-10-22

Readme and manuals

Help Manual

Help pageTopics
Add an ion to balance overall charge in a waterbalance_ions balance_ions_df
Determine TOC removal from biofiltration using Terry & Summers BDOC modelbiofilter_toc biofilter_toc_df
Determine blended water quality from multiple waters based on mass balance and acid/base equilibriumblend_waters blend_waters_df
Data frame of bromate coefficients for predicting bromate formation during ozonationbromatecoeffs
Calculate activity coefficientscalculate_activity
Calculate six corrosion and scaling indices (AI, RI, LSI, LI, CSMR, CCPP)calculate_corrosion calculate_corrosion_df
Calculate hardness from calcium and magnesiumcalculate_hardness
Calculate chlorine and chloramine Concentrations with the breakpoint cblorination approachchemdose_chloramine chemdose_chloramine_df
Calculate chlorine decaychemdose_chlordecay chemdose_chlordecay_df
Calculate DBP formationchemdose_dbp chemdose_dbp_df
Calculate new pH and ion balance after chemical additionchemdose_ph chemdose_ph_df
Determine TOC removal from coagulationchemdose_toc chemdose_toc_df
Data frame of conversion factors for estimating DBP formation from chloramineschloramine_conv
Data frame of Cl2 decay coefficientscl2coeffs
Calculate unit conversions for common compoundsconvert_units
Convert 'water' class object to a dataframeconvert_water convert_watermg
Correct acid dissociation constantscorrect_k
Data frame of correction factors for estimating DBP formation as a function of locationdbp_correction
Data frame of DBP coefficients for predicting DBP formationdbpcoeffs
Apply decarbonation to a waterdecarbonate_ph decarbonate_ph_df
Create a water class object given water quality parametersdefine_water
Apply 'define_water' within a dataframe and output a column of 'water' class to be chained to other tidywater functionsdefine_water_df
Dissociation constants and standard enthalpy for weak acids/basesdiscons
Calculate Dissolved Copper Concentrationdissolve_cu
Calculate Dissolved Copper Concentrationdissolve_cu_df
Simulate contributions of various lead solids to total soluble leaddissolve_pb dissolve_pb_df
Data frame of Edwards model coefficientsedwardscoeff
Calculate TOC Concentration in GAC systemgac_toc gac_toc_df
Calculate maximum bed volumes to stay below target DOCgacbv_toc gacbv_toc_df
Calculate TOC Concentration in GAC systemgacrun_toc gacrun_toc_df
Data frame of equilibrium constants for lead and copper solubilityleadsol_constants
Modify slots in a 'water' class objectmodify_water modify_water_df
Molar weights of relevant compoundsmweights
Calculate pH for water in an open systemopensys_ph opensys_ph_df
Calculate bromate formationozonate_bromate ozonate_bromate_df
Calculate DOC Concentration in PAC systempac_toc pac_toc_df
Data frame of PAC TOC model coefficientspactoccoeffs
Create summary plot of ions from water classplot_ions
Create dissolved lead and DIC contour plot given input data frameplot_lead
Pluck out a single parameter from a 'water' class objectpluck_water
Determine if TOC removal meets Stage 1 DBP Rule requirementsregulate_toc regulate_toc_df
Determine chemical costsolvecost_chem
Determine labor costsolvecost_labor
Determine power costsolvecost_power
Determine solids disposal costsolvecost_solids
Determine disinfection credit from chlorine.solvect_chlorine solvect_chlorine_df
Determine disinfection credit from ozone.solvect_o3 solvect_o3_df
Calculate a desired chemical dose for a target alkalinitysolvedose_alk solvedose_alk_df
Calculate a desired chemical dose for a target pHsolvedose_ph solvedose_ph_df
Convert mg/L of chemical to lb/daysolvemass_chem
Determine solids lb/daysolvemass_solids
Determine ozone decaysolveresid_o3 solveresid_o3_df
Create summary table from water classsummarise_wq summarize_wq
Data frame of TOC removal requirements per Stage 1 DBP Ruletoc_compliance_table
Data frame of virus log removal CT valuesvlog_removalcts
Data frame of water quality parameterswater_df