base_line: Baseline correction using the baseline package#'

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Estimates baselines for the spectra in the obj object, using the algorithm named in 'method'.

Usage

1
2
## S4 method for signature 'Spectra'
base_line(object, ...)

Arguments

object

an object inheriting from class Spectra

...

additional arguments to be passed to the baseline function in the baseline package. The main option would be 'method', to switch between the several baseline methods presented in teh details section.

Details

The baseline package implements various algorithms for the baseline correction. The following methods are available:

See baseline package documentation for more information and references.

Additionally, the baseline package provides a nice GUI that helps choosing the good baseline method and the good parametrisation. This GUI can be used with the inspectr package. This is demonstrate in the Examples section.

Value

An object of the same class as obj with the continuum removed from its spectra.

Author(s)

Interface to the baseline package by Pierre Roudier pierre.roudier@gmail.com, baseline package authored by Kristian Hovde Liland and Bjorn-Helge Mevik

References

Kristian Hovde Liland and Bjorn-Helge Mevik (2011). baseline: Baseline Correction of Spectra. R package version 1.0-1. http://CRAN.R-project.org/package=baseline

See Also

continuum_removal, snv, rnv

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Loading example data
data(australia)
spectra(australia) <- sr_no ~ ... ~ 350:2500

# Subsample for demo purposes
australia <- australia[1:10,]

# Correction using the default method (irls)
bl <- base_line(australia)
plot(bl)

# Specifying another method for baseline calculation
bl2 <- base_line(australia, method = "modpolyfit")
plot(bl2)

# Using the baseline package independently
# (useful to plot the corrections)
## Not run: 
library(baseline)
bl3 <- baseline(spectra(australia), method = 'irls')
class(bl3) # this is a baseline object
plot(bl3)
# Affecting the baseline-corrected spectra back
# to the SpectraDataFrame object
spectra(australia) <- getCorrected(bl3)
plot(australia)

# Using the baselineGUI with inspectr
baselineGUI(spectra(australia))
## When happy with a configuration, clik "Apply to all" and 
## save the results under a name, e.g. "corrected.spectra"
spectra(australia) <- getCorrected(corrected.spectra)
plot(australia)

## End(Not run)

spectacles documentation built on Jan. 13, 2021, 8:46 a.m.