Learn R Programming

ChemoSpec (version 3.0-1)

baselineSpec: Carry out baseline correction on a Spectra object

Description

This function is a simple wrapper to functions in package baseline which carries out a variety of baseline correction routines.

Usage

baselineSpec(Spectra, int = TRUE, retC = FALSE, ...)

Arguments

Spectra
An object of S3 class "Spectra" to be checked.
int
Logical; if TRUE, do the correction interactively using widgets. No results are saved. Use this for inspection and exploration only.
retC
Logical: shall the baseline-corrected spectra be returned in the Spectra object?
...
Other arguments passed downstream. The relevant ones can be found in baseline. Be sure to pay attention to argument method as you will probably want to use it.

Value

  • If int = TRUE, an interactive plot is created. If int = FALSE and retC = FALSE, an object of class baseline is returned (see baseline-class. If int = FALSE and retC = TRUE, a Spectra object containing the corrected spectra is returned. In these latter two cases plots are also drawn.

Details

In the plots, the x axis ticks give the data point index, not the original values from your data. Note that you cannot zoom the non-interactive display of corrected spectra because the underlying function hardwires the display. Try the interactive version instead (int = TRUE).

References

https://github.com/bryanhanson/ChemoSpec

Examples

Run this code
data(SrE.IR)
temp <- baselineSpec(SrE.IR, int = FALSE, method = "rfbaseline")
par(mfrow = c(1,1)) # needed to cancel 2 panel plot
baselineSpec(SrE.IR)
par(mfrow = c(1,1)) # needed to cancel 2 panel plot

Run the code above in your browser using DataLab