Learn R Programming

iwaqr (version 1.8.4)

calculate_tc: Calculate Total Concentration (tc)

Description

This function calculates the total concentration (tc) based on the provided dataframe.

Usage

calculate_tc(df, convert_units = FALSE)

Value

A numeric vector representing the total concentration (tc) for each row in the dataframe.

Arguments

df

Data frame containing the necessary columns.

convert_units

Logical, indicating whether to convert units from mg/l to meq/l.

Examples

Run this code
df <- data.frame(Ca = c(10, 20, 30),
Mg = c(5, 10, 15), Na = c(8, 16, 24),
Na = c(15, 25, 10),
K = c(2, 6, 4),
HCO3 = c(15, 30, 45),
SO4 = c(110, 115, 88),
CO3 = c(0, 0, 0),
Cl = c(42, 25, 16))
calculate_tc(df, convert_units = TRUE)

Run the code above in your browser using DataLab