ir_bc | R Documentation |
ir_bc
performs baseline correction for infrared spectra. Baseline
correction is either performed by using a polynomial with user defined
degree fitted to each spectrum (see ChemoSpec::baselineSpectra()
), or by
using a rubberband function that is fitted to each spectrum (see
hyperSpec::spc.rubberband()
), or using a Savitzky-Golay smoothed version of
the input spectra (see ir_bc_sg()
).
ir_bc(x, method = "rubberband", ..., return_bl = FALSE)
x |
An object of class |
method |
A character value indicating which method should be used
for baseline correction. If |
... |
Further arguments passed to |
return_bl |
A logical value indicating if for each spectrum the baseline
should be returned instead of the corrected intensity values
( |
An object of class ir
with the baseline corrected spectra, or if
return_bl = TRUE
, the baselines instead of the spectra in column spectra
.
library(dplyr) # rubberband baseline correction x1 <- ir::ir_sample_data %>% dplyr::slice(1:10) %>% ir::ir_bc(method = "rubberband") # polynomial baseline correction x2 <- ir::ir_sample_data %>% dplyr::slice(1:10) %>% ir::ir_bc(method = "polynomial", degree = 2) # Savitzky-Golay baseline correction x3 <- ir::ir_sample_data %>% dplyr::slice(1:10) %>% ir::ir_bc(method = "sg", p = 3, n = 199, ts = 1, m = 0) # return the baseline instead of the baseline corrected spectra x1_bl <- ir::ir_sample_data %>% dplyr::slice(1:10) %>% ir::ir_bc(method = "rubberband", return_bl = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.