Learn R Programming

mdatools (version 0.7.0)

prep.snv: Standard Normal Variate transformation

Description

Applies Standard Normal Variate (SNV) transformation to the rows of data matrix

Usage

prep.snv(data)

Arguments

data
a matrix with data values

Value

data matrix with processed values

Details

SNV is a simple preprocessing to remove scatter effects (baseline offset and slope) from spectral data, e.g. NIR spectra.

Examples

Run this code
### Apply SNV to spectra from simdata

 library(mdatools)
 data(simdata)

 spectra = simdata$spectra.c
 wavelength = simdata$wavelength

 cspectra = prep.snv(spectra)

 par(mfrow = c(2, 1))
 mdaplot(cbind(wavelength, t(spectra)), type = 'l', main = 'Before SNV')
 mdaplot(cbind(wavelength, t(cspectra)), type = 'l', main = 'After SNV')

Run the code above in your browser using DataLab