Title: Calculate Urinary Saturation with the EQUIL2 Algorithm
Version: 1.0.0
Description: Saturation of ionic substances in urine is calculated based on sodium, potassium, calcium, magnesium, ammonia, chloride, phosphate, sulfate, oxalate, citrate, ph, and urate. This program is intended for research use, only. The code within is translated from EQUIL2 Visual Basic code based on Werness, et al (1985) "EQUIL2: a BASIC computer program for the calculation of urinary saturation" <doi:10.1016/s0022-5347(17)47703-2> to R. The Visual Basic code was kindly provided by Dr. John Lieske of the Mayo Clinic.
Imports: units
Suggests: covr, knitr, rmarkdown, spelling, testthat (≥ 3.0.0)
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.2.2
Config/testthat/edition: 3
URL: https://billdenney.github.io/equil2/
VignetteBuilder: knitr
Language: en-US
NeedsCompilation: no
Packaged: 2022-12-20 15:00:30 UTC; wdenn
Author: Bill Denney ORCID iD [aut, cre, cph], John Lieske ORCID iD [cph]
Maintainer: Bill Denney <wdenney@humanpredictions.com>
Repository: CRAN
Date/Publication: 2022-12-20 19:40:02 UTC

Add units to support unit conversion for calculations

Description

Units are added to support molecular weight and mEq/L conversions. Units are named with the unit, an underscore, and the chemical species in lower case. Examples are "g_ammonia", "mol_ammonia", and "Eq_ammonia". Species with units are all species inputs for the equil2() function.

Usage

add_units()

Value

NULL, the function is used for its side-effects


Calculate urine saturation with the EQUIL-2 algorithm

Description

Calculate urine saturation with the EQUIL-2 algorithm

Usage

equil2(
  sodium_mEq_L,
  potassium_mEq_L,
  calcium_mg_dL,
  magnesium_mg_dL,
  ammonia_mEq_L,
  chloride_mEq_L,
  phosphate_mg_dL,
  sulfate_mg_dL,
  oxalate_mg_dL,
  citrate_mg_dL,
  pH,
  urate_mg_dL
)

Arguments

sodium_mEq_L, potassium_mEq_L, ammonia_mEq_L, chloride_mEq_L

Concentration of the given species in mEq/L (or a unit value that can be converted to mEq/L)

calcium_mg_dL, magnesium_mg_dL, phosphate_mg_dL, sulfate_mg_dL, oxalate_mg_dL, citrate_mg_dL, urate_mg_dL

Concentration of the given species in mg/dL (or a unit value that can be converted to mg/dL)

pH

The urine pH

Details

This program is intended for research use, only. The code within is translated from Visual Basic code based on Werness, et al 1985 to R. The Visual Basic code was kindly provided by Dr. John Lieske of the Mayo Clinic.

Value

A data.frame with three columns:

References

Werness PG, Brown CM, Smith LH, Finlayson B. Equil2: A Basic Computer Program for the Calculation of Urinary Saturation. Journal of Urology. 1985;134(6):1242-1244. doi:10.1016/S0022-5347(17)47703-2

Examples

# Example values from https://files.labcorp.com/testmenu-d8/sample_reports/306266.pdf
equil2(
  sodium_mEq_L=units::set_units(45, "mmol_sodium/L"),
  potassium_mEq_L=units::set_units(55, "mmol_potassium/L"),
  calcium_mg_dL=units::set_units(15, "mg_calcium/dL"),
  magnesium_mg_dL=units::set_units(15, "mg_magnesium/dL"),
  ammonia_mEq_L=units::set_units(10, "ug_ammonia/dL"),
  chloride_mEq_L=units::set_units(75, "mmol_chloride/L"),
  phosphate_mg_dL=units::set_units(100, "mg_phosphate/dL"),
  sulfate_mg_dL=units::set_units(20, "mEq_sulfate/L"),
  oxalate_mg_dL=units::set_units(10, "mg_oxalate/L"),
  citrate_mg_dL=units::set_units(400, "mg_citrate/L"),
  pH=5.5,
  urate_mg_dL=units::set_units(50, "mg_urate/dL")
)