Learn R Programming

proximetricsR (version 0.6.5)

prep_transform: Reflectance/absorbance conversion constructor for spectral preprocessing

Description

Creates a preprocessing constructor for converting spectral data between reflectance and absorbance. The constructor is intended to be passed to preprocess_recipe and executed via process.

Usage

prep_transform(to = c("absorbance", "reflectance"))

Value

An object of class preprocessing to be used in preprocess_recipe and executed by process.

Arguments

to

A character string specifying the target unit. Either "absorbance" (default) or "reflectance".

Author

Leonardo Ramirez-Lopez

Details

Conversion follows Beer's Law:

A = -_10(R)A = -log10(R)

where AA is absorbance and RR is reflectance.

When converting to absorbance, all values in X must be strictly positive. A warning is issued if the resulting absorbance contains small negative values, which may indicate precision or scaling issues in the input.

Note that no check is performed on whether the input is actually in the expected unit (the transformation is applied as specified).

See Also

preprocess_recipe, process

Examples

Run this code
data("NIRcannabis")
X <- NIRcannabis$spc # absorbance

tr <- prep_transform(to = "reflectance")
recipe <- preprocess_recipe(tr, device = "proxiscout")
X_ref <- process(X, recipe)

Run the code above in your browser using DataLab