Skip to contents

Calculates MEQ values for 'long' data in mg/L. Expects columns: "aqua_code" and "RESULT", where "aqua_code" is the parameter type (e.g., "Zn_diss") and RESULT is the numeric concentration in mg/L.

Usage

meq(d, drop_na = FALSE)

Arguments

d

Data frame. Long data containing parameters and results

drop_na

Logical. Whether to omit missing parameters

Details

For conversion details see the included data frame, meq_conversion.

Also see ?meq_conversion for a description of the data.

MEQs are calculated by dividing the parameter concentration in mg/L by the conversion factor.

Note: This is an internal function, exported for clarity in calculations

Examples


d <- data.frame(aqua_code = c("Cl", "HCO3"), RESULT = c(5.7, 38.3))
d
#>   aqua_code RESULT
#> 1        Cl    5.7
#> 2      HCO3   38.3
meq(d, drop_na = TRUE)
#> # A tibble: 2 × 4
#>   aqua_code RESULT UNIT  aqua_unit
#>   <chr>      <dbl> <chr> <chr>    
#> 1 Cl_meq     0.161 meq   meq      
#> 2 HCO3_meq   0.628 meq   meq      
meq(d)
#> # A tibble: 18 × 4
#>    aqua_code    RESULT UNIT  aqua_unit
#>    <chr>         <dbl> <chr> <chr>    
#>  1 Al_diss_meq  NA     meq   meq      
#>  2 CO3_meq      NA     meq   meq      
#>  3 Ca_meq       NA     meq   meq      
#>  4 Cl_meq        0.161 meq   meq      
#>  5 Cu_diss_meq  NA     meq   meq      
#>  6 F_meq        NA     meq   meq      
#>  7 Fe_diss_meq  NA     meq   meq      
#>  8 HCO3_meq      0.628 meq   meq      
#>  9 K_meq        NA     meq   meq      
#> 10 Meas_Alk_meq NA     meq   meq      
#> 11 Mg_meq       NA     meq   meq      
#> 12 Mn_diss_meq  NA     meq   meq      
#> 13 NH4_meq      NA     meq   meq      
#> 14 NO2_meq      NA     meq   meq      
#> 15 NO3_meq      NA     meq   meq      
#> 16 Na_meq       NA     meq   meq      
#> 17 SO4_meq      NA     meq   meq      
#> 18 Zn_diss_meq  NA     meq   meq