Learn R Programming

spftir (version 0.1.0)

spmws: Moving-average Smoothing Filter of a Mid-infrared Spectrum

Description

This function allows applying a Moving-average smoothing filter to the mid-infrared spectrum (N spectra = 1).

Usage

spmws(spectrum, N = 21)

Arguments

spectrum
matrix. The matrix of FTIR spectrum. The first row corresponds to wavenumber; the second row corresponds to absorbances.
N
numeric. Length of the smoothing window. Defaults to 21.

Value

A smoothed spectrum matrix by means of a Moving-average smoothing filter. The first row corresponds to wavenumber; the second row corresponds to absorbances.

Examples

Run this code
data(spData)
# Convert data frame to matrix
spectrum <- as.matrix(t(spData[, c("Wavenumber","A")]))
# Smoothed spectrum
mws <- spmws(spectrum = spectrum, N = 21)

Run the code above in your browser using DataLab