Skip to contents

These functions simply subtract (by default) detector counts data (raw or cps) of one spectrum by the corresponding columns in another spectrum, or apply a user supplied operator or function to them.

Usage

ref_correction(x, y, .oper, ...)

# Default S3 method
ref_correction(x, y, .oper, ...)

# S3 method for class 'numeric'
ref_correction(x, y, .oper = `-`, ...)

# S3 method for class 'raw_spct'
ref_correction(x, y, .oper = `-`, ...)

# S3 method for class 'cps_spct'
ref_correction(x, y, .oper = `-`, ...)

# S3 method for class 'cps_mspct'
ref_correction(x, y = x, .oper = `-`, ref_name = "dark", ...)

Arguments

x, y

R objects

.oper

a function with its first two formal parameters accepting numerical vectors of equal length (e.g. a binary numerical operator).

...

not used in current version

ref_name

character Name of variable to substract from all other columns.

Value

a numeric vector of the same length as x

an object of class "cps_spct"

an object of class "cps_spct"

an object of class "cps_mspct"

Methods (by class)

  • ref_correction(default): Default method

  • ref_correction(numeric): Numeric method

  • ref_correction(raw_spct): Method for spectral data expressed as raw instrument counts.

  • ref_correction(cps_spct): Method for spectral data expressed as counts per second.

  • ref_correction(cps_mspct): Method for collections of spectral data objects containing data expressed as counts per second.

Note

In the case of objects of class "raw_spct" the columns with names starting with "counts" are processed. All other columns are left unchanded.

If x and y are both cps_mspct objects, y[[ref_name]] will be used as reference, otherwise y itself should be a cps_spct and will be used as is. In all cases variables in ref.name will be skipped in x.