Skip to contents

step_measure_normalize_istd() is an alias for step_measure_normalize_peak() with domain-specific naming for chromatography and mass spectrometry users. It normalizes spectra by dividing by a value computed from a specific region (internal standard peak).

Usage

step_measure_normalize_istd(
  recipe,
  location_min,
  location_max,
  method = "mean",
  measures = NULL,
  role = NA,
  trained = FALSE,
  skip = FALSE,
  id = recipes::rand_id("measure_normalize_istd")
)

Arguments

recipe

A recipe object. The step will be added to the sequence of operations for this recipe.

location_min

Numeric. The lower bound of the region to use for normalization. This parameter is tunable with peak_location_min().

location_max

Numeric. The upper bound of the region to use for normalization. This parameter is tunable with peak_location_max().

method

Character. The summary statistic to compute from the region. One of "mean" (default), "max", or "integral".

measures

An optional character vector of measure column names to process. If NULL (the default), all measure columns (columns with class measure_list) will be processed. Use this to limit processing to specific measure columns when working with multiple measurement types.

role

Not used by this step since no new variables are created.

trained

A logical to indicate if the quantities for preprocessing have been estimated.

skip

A logical. Should the step be skipped when the recipe is baked by recipes::bake()? While all operations are baked when recipes::prep() is run, some operations may not be able to be conducted on new data (e.g. processing the outcome variable(s)). Care should be taken when using skip = TRUE as it may affect the computations for subsequent operations.

id

A character string that is unique to this step to identify it.

Value

An updated version of recipe with the new step added.

Details

This function is identical to step_measure_normalize_peak() but uses terminology familiar to chromatography and mass spectrometry practitioners.

Internal standard (ISTD) normalization is commonly used to correct for:

  • Injection volume variations

  • Ionization efficiency differences

  • Matrix effects

  • Instrument drift

The internal standard should be a compound that:

  • Is chemically stable

  • Does not naturally occur in samples

  • Elutes in a distinct region

  • Has consistent response

Examples

library(recipes)

# Normalize to internal standard peak region (channels 50-60)
rec <- recipe(water + fat + protein ~ ., data = meats_long) |>
  update_role(id, new_role = "id") |>
  step_measure_input_long(transmittance, location = vars(channel)) |>
  step_measure_normalize_istd(
    location_min = 50,
    location_max = 60,
    method = "integral"
  )