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", ...)
```

## 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`

.

## See also

Other spectral data-processing functions:
`MAYP112785_tail_correction()`

,
`MAYP11278_tail_correction()`

,
`check_sn_match()`

,
`linearize_counts()`

,
`merge_raw_mspct()`

,
`new_correction_method()`

,
`trim_counts()`

,
`uvb_corrections()`