Learn R Programming

specmine (version 1.0)

shift_correction: Shift correction

Description

Shifts the spectra according to a specific method.

Usage

shift_correction(dataset, method = "constant", shift.val = 0, interp.function = "linear", ref.limits = NULL)

Arguments

dataset
list representing the dataset from a metabolomics experiment.
method
string that indicates the shifting method. It can be:
  • "constant" uses a constant shift that is added to the x-values
  • "interpolation" uses interpolation according to "interp.function"

shift.val
value of the shift (for constant and interpolation methods); can be a single value for all spectra, can be the string "auto", the shifts are automatically determined or a vector with the size of the number of samples with the shifts for each spectra.
interp.function
string that represents the interpolation function, can be "linear" or "spline".
ref.limits
vector with 2 elements that represents the reference limits to calculate the shifts.

Value

Returns the dataset with the spectras shifted.

Examples

Run this code
  ## Example of shift correction with linear interpolation and 
  ## shifts calculated based on a reference band of the spectra
  data(cassavaPPD)
  dataset.corrected = shift_correction(cassavaPPD, method = "interpolation", 
		      shift.val = "auto", interp.function = "linear", 
		      ref.limits = c(800,850))

Run the code above in your browser using DataLab