elco_irms_correct_elements: Heuristic function to correct IRMS element contents by...

View source: R/elco_irms_correct_elements.R

elco_irms_correct_elementsR Documentation

Heuristic function to correct IRMS element contents by computing a manual calibration function from the standard measurements and apply this to predict element contents in samples.

Description

elco_irms_correct_elements is a heuristic function to correct measured element contents of samples during IRMS analysis. Correction can be performed for either C or 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 each measured standard, assign the known reference element mass content from irms_standards.

  2. Use the information on the mass of the measured samples and the assigned element mass content values to compute the respective absolute known element content [mg].

  3. For all measured standards, compute a linear regression model that predicts the absolute element content in dependency of the respective signal area.

  4. For each sample, use the regression model and the respective measured signal area to compute the absolute element content.

  5. Divide the absolute predicted element contents by the samples' masses [mg] to get the mass fraction of the element.

  6. (Optionally): create plot: (1) showing uncorrected and corrected element mass fractions for all measured standards and samples. This plot may be used as a visual check of the heuristic correction procedure and shows how the values for all samples are corrected. In addition, for each fitted regression model, the measured absolute element masses are plotted in dependency of the signal areas with the regression line. These plot can be used to assess if the regression model captures well the measured data for the standards.

Usage

elco_irms_correct_elements(
  x,
  element = "C",
  standards = irms_standards$standard_name,
  by_file = TRUE,
  plotit = FALSE
)

Arguments

x

An object of class irms().

element

A character value representing the chemical element for which to correct the mass fraction values. This must be one of "C" or "N".

standards

A character vale specifying standards to use for computing the regression equation. This must be one of irms_standard::irms_standard$standard_name. Default is to use all standards.

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).

Value

x with corrected element content.


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