Skip to contents

[Deprecated]

A function to correct the measured values for non-complete gas exchange. Per sample, a total balance (b_tot) is obtained by adding the measurements of all gases and, if necessary, corrected for missing gases.
Theoretically, bal is between (0;1), however values over 1 can result from calibration errors. Values over 1 are treated the same and are corrected. Then, each x_ppm is corrected: x_ppm / b_tot

Usage

balance_correction(
  df,
  limits = c(-999, +999),
  gases = c("N2", "O2", "Ar", "CO2"),
  gases_std = c(0.78084, 0.20946, 0.00934, 0.0407),
  gases_ob = c("N2", "O2"),
  set_na = FALSE
)

Arguments

df

(dataframe) The gasdata-dataframe. The dataframe will be altered in the process of the function, so that it has to be overwritten (see examples below).

limits

(vector, numeric) A vector of two that contains the upper and lower limits for b_tot, above and below which x_ppm are flagged and set NA, if set_na is TRUE.

gases

(vector, character) A character vector of the gases that should be used in the balance approach. Default are the four most abundant atmospheric gases (N2, O2, Ar, CO2). Spelling must match the spelling of the gas-column in gasdata exactly.

gases_std

(vector, numeric) A numeric vector of standard values to be used for missing gases as fraction of total volume. Values of b_tot recalculated to account for the missing gases based on the gases present and these standard values. This is achieved by assuming a balance of the gases present first and recalculating gases_st accordingly.
Order must match input of gases. Defaults to c(0.78084,0.20946,0.009340,0.0407))

gases_ob

(vector, character) A vector of obligatory gases that must be present for correct balance calculation. x_ppm of samples missing any of these gases will be flagged in bal_flag and not corrected or set NA. Defaults to c("N2","O2").

set_na

(logical) Should flagged values be set to NA (bal_flag == T)? Default is F.

Value

gasdata (dataframe) With added columns

bal = balance

bal_flag TRUE if value was not corrected (or set NA).

x_ppm, corrected for balance

See also

Examples

{
data("gasdata")
                              }