Calculate the ionic ratio of a water sample based on the output of
get_chem and add it to the input data as a new column ir.
Value
A tibble similar to the input data but with an extra column ir
with the calculated ionic ratio.
Details
Depending on the units of the Ca and Cl concentrations, the ionic ratio gets calculated as follows:
if the Ca and Cl concentrations are in meq/l: ionic ratio = [Ca2+] / ([Ca2+] + [Cl-])
if the Ca and Cl concentrations are in mg/l: ionic ratio = ((Ca_mg*2)/40.078) / (((Ca_mg*2)/40.078) + (Cl_mg/35.453))
The result is the ionic ratio ir without units (0-1).
Examples
if (FALSE) { # \dontrun{
watina <- connect_watina()
# get the chemical data
mydata <-
get_locs(watina, area_codes = "ZWA") %>%
get_chem(watina, "1/1/2019") %>%
collect()
# compute ionic ratio and add as new field
mydata_with_ir <- calculate_ir(mydata)
} # }