step_sec_dad() creates a specification of a recipe step that processes
diode array detector (DAD) signals across multiple wavelengths. It can apply
wavelength-specific extinction coefficients and optionally compute ratios to
a reference wavelength.
Arguments
- recipe
A recipe object.
- measures
Character vector of DAD/UV measure columns. If
NULL, the step searches for measure columns containing "dad" or "uv".- wavelengths
Numeric vector of wavelengths (nm) aligned with
measures. IfNULL, attempts to parse wavelengths frommeasuresnames.- extinction_coefs
Extinction coefficients by wavelength. Accepts a named numeric vector (names are wavelengths), an unnamed vector aligned with
wavelengths, or a data frame with columnswavelengthandextinction_coef.- reference_wavelength
Optional wavelength used as denominator for ratio calculations.
- output_prefix
Prefix used to name output columns (e.g.,
uv_254).- path_length
Path length of the flow cell in cm. Default is 1.0.
- role
Role for generated columns.
- trained
Logical indicating if the step has been trained.
- skip
Logical. Should the step be skipped when baking?
- id
Unique step identifier.
Details
For each wavelength, the signal can be normalized using the Beer-Lambert law:
$$A = \varepsilon \times c \times l$$
where A is absorbance (AU), epsilon is the extinction coefficient, and
l is the path length. When reference_wavelength is provided, the step
additionally creates ratio columns for each wavelength vs the reference.
Examples
if (FALSE) { # \dontrun{
library(recipes)
library(measure)
rec <- recipe(~., data = sec_triple_detect) |>
step_measure_input_long(uv_254, location = vars(elution_time), col_name = "uv_254") |>
step_measure_input_long(uv_280, location = vars(elution_time), col_name = "uv_280") |>
step_sec_dad(
measures = c("uv_254", "uv_280"),
wavelengths = c(254, 280),
extinction_coefs = c(`254` = 1.2, `280` = 1.0),
reference_wavelength = 280
) |>
prep()
} # }