View source: R/custom.baseline.R
custom.baseline | R Documentation |
This function rescales spectrum abscissa by use of breaks
and
gaps
before baseline correction. The effect is that the
chosen baseline correction algorithm and paramters will have varying
effects along the spectra, effectively giving local control of the amount
of rigidity/flexibility of the estimated baseline.
custom.baseline(spectra, breaks, gaps, trans.win = NULL, just.plot = FALSE, method, ...)
spectra |
Matrix with spectra in rows. |
breaks |
Vector of locations of break points between sections of varying baseline flexibility (given as abscissa numbers). |
gaps |
Vector giving the abscissa spacing between each instance of
|
trans.win |
Optional width of transition window around break points used for smoothing rough breaks by LOWESS (default = NULL). |
just.plot |
Plot the rescaled spectra instead of applying the customized
baseline correction if |
method |
Baseline correction method to use (class character). |
... |
Additional named arguments to be passed to the baseline correction method. |
This is an implementation of the customized baseline correction suggested by Liland et al. 2011 for local changes in baseline flexibility.
baseline |
Estimated custom baselines. |
corrected |
Spectra corrected by custom baselines. |
spectra.scaled |
Re-scaled spectra. |
baseline.scaled |
Estimated baselines of re-scaled spectra. |
Kristian Hovde Liland and Bjørn-Helge Mevik
Kristian Hovde Liland et al.: Customized baseline correction
data(milk)
spectrum1 <- milk$spectra[1,1:10000,drop=FALSE]
ordinary <- baseline(spectrum1, method="als", lambda=6, p=0.01)
customized <- custom.baseline(spectrum1, 2900, c(1,20), trans.win=100,
just.plot=FALSE, method="als", lambda=6, p=0.01)
## Not run:
plot(1:10000,spectrum1, type='l')
lines(1:10000,getBaseline(ordinary), lty=2, col=2, lwd=2)
lines(1:10000,customized$baseline, lty=3, col=3, lwd=2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.