pretreat_spectra {waves}R Documentation

Pretreat spectral data according to user-designated method

Description

Pretreatment, also known as preprocessing, is often used to increase the signal to noise ratio in vis-NIR datasets. The waves function pretreat_spectra applies common spectral pretreatment methods such as standard normal variate and the Savitzky-Golay filter.

Usage

pretreat_spectra(
  df,
  test.data = NULL,
  pretreatment = 1,
  preprocessing.method = deprecated(),
  wavelengths = deprecated()
)

Arguments

df

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.

test.data

data.frame object with same format as train.data. Will be appended to df during pretreatment so that the same transformations are applied to each row. Default is NULL.

pretreatment

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–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)

preprocessing.method

DEPRECATED preprocessing.method has been renamed "pretreatment"

wavelengths

DEPRECATED wavelengths is no longer supported; this information is now inferred from df column names

Value

Pretreated df' (or list of data.frames) with reference column intact

Author(s)

Jenna Hershberger jmh579@cornell.edu

Examples

pretreat_spectra(df = ikeogu.2017, pretreatment = 3)[1:5, 1:5]

[Package waves version 0.2.5 Index]