elco_irms_correct_isotopes: Heuristic function to correct IRMS isotope signals by...

View source: R/elco_irms_correct_isotopes.R

elco_irms_correct_isotopesR Documentation

Heuristic function to correct IRMS isotope signals by subtracting differences measured values for standards and their known isotope signature.

Description

elco_irms_correct_isotopes is a heuristic function to correct measured isotope signatures of samples during IRMS analysis. Correction can be performed for either ^{13}C or ^{13}N and, if multiple files are batch-processed, using either standards from all files or only from the file where the respective sample is located in. The procedure is as follows:

  1. For a standard defined by the user, compute the median of the individually measured isotope signals for the selected isotope. The defined standard should be a trusted standard.

  2. For the same standard, count the number of samples that have been measured. If this number is smaller than a threshold t, print a warning. This is done to avoid that correction is done without enough samples to reliably compute a median value.

  3. Look up the known reference isotope signature for the selected standard. Compute the difference between this value and the median of the isotope signature of the standard. Take this difference and subtract it from each measured value.

  4. (Optionally): Extract the values of other standards after the correction, compute their medians, and check if the absolute deviation from the reference value is larger than some threshold. Print a warning if this is the case.

  5. (Optionally): create a plot showing uncorrected and corrected isotope signatures for all measured standards along their known reference values. This plot may be used as a visual check of the heuristic correction procedure.

Usage

elco_irms_correct_isotopes(
  x,
  ref = irms_standards[irms_standards$standard_name == "BBOT", ],
  check = irms_standards,
  isotope = "13C",
  t = 5,
  by_file = TRUE,
  plotit = FALSE
)

Arguments

x

An object of class irms().

ref

A data.frame with the same format as irms_standards() and exactly one row. ref contains the data for the standard to use for the correction.

check

A data.frame with the same format as irms_standards(). check contains data for standards with which to check the correction. If the median of their corrected isotope signature values deviates (absolutely) by more than a threshold value as defined by check$threshold_13C or check$threshold_15N (depending on the value of isotope), a warning will be printed. Can alternatively be set to NULL, in which case no warning is printed.

isotope

A character value representing the isotope for which to correct isotope signatures. This must be one of "13C" or "15N".

t

An integer value specifying the number of measurements that must be available for a particular standard to make it eligible for being a reference for correcting the measured isotope values.

by_file

A logical value indicating if medians of standards are computed across different files as indicated by x$file_id or (FALSE) individually for each file (TRUE).

plotit

A logical value indicating if a plot for checking should be printed (TRUE) or not (FALSE).


henningte/elco documentation built on May 21, 2022, 6:56 p.m.