Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

sgfSpectra

Apply Savitzky-Golay filters to a Spectra object


Description

This function is a simple wrapper around the function sgolayfilt. It allows one to apply Savitzky-Golay filters to a Spectra object in a convenient way.

Usage

sgfSpectra(spectra, m = 0, ...)

Arguments

spectra

An object of S3 class Spectra to be checked.

m

The desired m-th derivative. m = 0 smooths the data (i.ei a rolling average), m = 1 gives the first derivative etc.

...

Other parameters to be passed to sgolayfilt.

Value

A object of class Spectra.

Author(s)

Bryan A. Hanson, DePauw University.

See Also

Additional documentation at https://bryanhanson.github.io/ChemoSpec/

Examples

data(SrE.IR)
myt1 <- expression(bolditalic(Serenoa) ~ bolditalic(repens) ~ bold(IR ~ Spectra))
myt2 <- expression(bolditalic(Serenoa) ~ bolditalic(repens) ~ bold(IR ~ Spectra ~ (Smoothed)))

par(mfrow = c(2, 1))
plotSpectra(SrE.IR, xlim = c(1900, 2100), yrange = c(0, 0.05), main = myt1)
temp <- sgfSpectra(SrE.IR)
plotSpectra(temp, xlim = c(1900, 2100), yrange = c(0, 0.05), main = myt2)
par(mfrow = c(1, 1))

ChemoSpec

Exploratory Chemometrics for Spectroscopy

v5.3.11
GPL-3
Authors
Bryan A. Hanson [aut, cre] (<https://orcid.org/0000-0003-3536-8246>), Mike Bostock [cph, ctb] (author of the d3.js library used by plotSpectraJS, http://d3js.org), Matt Keinsley [ctb] (author of initial AOV-PCA code)
Initial release
2021-03-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.