Preprocessing, also known as pretreatment, is often used to
increase the signal to noise ratio in vis-NIR datasets. The waves
function DoPreprocessing applies common spectral preprocessing
methods such as standard normal variate and the Savitzky-Golay filter.
DoPreprocessing(df, test.data = NULL, preprocessing.method = 1,
wavelengths = 740:1070)data.frame object containing spectral data. First column(s)
(optional) include metadata (with or without reference value column)
followed by spectral columns. Spectral column names must be formatted as
"X" followed by wavelength Include no other columns to right of spectra! No
missing values permitted.
data.frame object with same format as train.data.
Will be appended to df during preprocessing so that the same
transformations are applied to each row. Default is NULL.
Number or list of numbers 1:13 corresponding to desired pretreatment method(s):
1 = raw data (default)
2 = standard normal variate (SNV)
3 = SNV and first derivative
4 = SNV and second derivative
5 = first derivative
6 = second derivative
7 = Savitzky<U+2013>Golay filter (SG)
8 = SNV and SG
9 = gap segment derivative (window size = 11)
10 = SG and first derivative (window size = 5)
11 = SG and first derivative (window size = 11)
12 = SG and second derivative (window size = 5)
13 = SG and second derivative (window size = 11)
List of wavelengths represented by each column in
df. Default is 740:1070.
Preprocessed df` (or list of data.frames) with
reference column intact
# NOT RUN {
DoPreprocessing(df = ikeogu.2017, wavelengths = 350:2500)[1:5,1:5]
# }
Run the code above in your browser using DataLab