Learn R Programming

spftir (version 0.1.0)

spsgb: Savitzky-Golay Smoothing Filter of a Mid-infrared Spectra

Description

This function allows applying a Savitzky-Golay smoothing filter to the mid-infrared spectra (N spectra > 1).

Usage

spsgb(spectra, p = 2, sw = 21)

Arguments

spectra
matrix. The matrix of FTIR spectra. The first row corresponds to wavenumber; the remaining rows corresponds to absorbances.
p
numeric. Filter order. Defaults to 2.
sw
numeric. Filter length (must be odd). Defaults to 21.

Value

A smoothed spectra matrix by means of a Savitzky-Golay smoothing filter. The first row corresponds to wavenumber; the remaining rows corresponds to absorbances.

Examples

Run this code
data(spData)
# Convert data frame to matrix
spectra <- as.matrix(t(spData))
# Smoothed spectra
sgb <- spsgb(spectra=spectra, p=2, sw= 21)

Run the code above in your browser using DataLab