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

binSpectra

Bin or Bucket a Spectra Object


Description

This function will bin a Spectra object by averaging every bin.ratio frequency values, and summing the corresponding intensity values. The net effect is a smoothed and smaller data set. If there are gaps in the frequency axis, each data chunk is processed separately. Note: some folks refer to binning as bucketing.

Usage

binSpectra(spectra, bin.ratio)

Arguments

spectra

An object of S3 class Spectra to be binned.

bin.ratio

An integer giving the binning ratio, that is, the number of points to be grouped together into one subset of data.

Details

If the frequency range is not divisible by bin.ratio to give a whole number, data points are removed from the beginning of the frequency data until it is, and the number of data points removed is reported at the console. If there are gaps in the data where frequencies have been removed, each continuous piece is sent out and binned separately (by binSpectra).

Value

An object of S3 class Spectra.

Author(s)

Bryan A. Hanson, DePauw University.

See Also

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

Examples

data(metMUD1)
sumSpectra(metMUD1)
res <- binSpectra(metMUD1, bin.ratio = 4)
sumSpectra(res)

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.