Preprocessing Tools for Laser-Induced Breakdown Spectroscopy
Overview
Tools for exploring, preprocessing and modeling spectroscopic data, developed for laser-induced breakdown spectroscopy (LIBS) and also applicable to other techniques such as Raman, infrared, and inductively coupled plasma optical emission spectroscopy. Covers the workflow from raw spectra to calibrated results: peak finding and fitting, wavelength calibration, baseline correction, normalization and scaling, orthogonal signal correction including orthogonal partial least squares (OPLS; Trygg and Wold (2002) doi:10.1002/cem.695), calibration transfer, calibration curves and figures of merit, and plasma diagnostics (Boltzmann and Saha-Boltzmann plots, Stark broadening). Includes robust tools for outlier detection and exploration: robust principal component analysis (Hubert, Rousseeuw and Vanden Branden (2005) doi:10.1198/004017004000000563), detection of deviating cells (Rousseeuw and Van den Bossche (2018) doi:10.1080/00401706.2017.1340909), PCA with cellwise outliers and missing values (MacroPCA; Hubert, Rousseeuw and Van den Bossche (2019) doi:10.1080/00401706.2018.1562989), robust transformations to central normality (Raymaekers and Rousseeuw (2021) doi:10.1007/s10994-021-05960-5), and self-organizing maps (Kohonen (1982) doi:10.1007/BF00337288). Preprocessing steps are also available as 'recipes' steps for 'tidymodels' workflows. Computationally intensive steps are implemented in 'C++' via 'Rcpp' and 'RcppEigen'.
New features
cellpca(): robust PCA by casewise and cellwise weighting (cellPCA, Centofanti, Hubert and Rousseeuw). It handles outlying observations, outlying cells and missing values by minimizing a single objective, with weights between 0 and 1 for every cell and observation. The iteratively reweighted least squares and the predictions of new data are computed in C++; the results agree with the reference code of the authors to numerical precision.predict(),plot_outlier_map()(enhanced outlier map),plot_cell_map()andflagged_regions()accept its fits, andstep_cellpca()is its recipe step.
Breaking changes
- The detection of deviating cells (DDC) behind
macropca()andcellpca()now follows the DDC algorithm of the cellWise package: 1-step M estimators for the standardization and the residual scales, the robust Gnanadesikan-Kettenring correlations for the neighbors (wrapped correlations, found exactly, for more than 750 variables), robust slopes refined by least squares, each cell included in its own prediction, and the standalone variables. It flags the same cells as cellWise, and more of the outlying cells with far fewer false flags than before.
Show all changes in 0.8.3Hide the rest of the changes in 0.8.3
macropca()now follows the MacroPCA algorithm of Hubert, Rousseeuw and Van den Bossche (2019), built on ROBPCA, as implemented in cellWise, whose results it reproduces (withscale = FALSE): projection pursuit on the data where only the observations with the fewest flagged cells are cell-imputed, iterative subspace estimation on a fixed set of observations, one reweighting step on the orthogonal distances, concentration steps and the deterministic MCD within the subspace, and distances from the data with only the missing cells imputed. New data are analyzed as by MacroPCApredict (with the DDC model of the fit). Its results change.tolis now the largest angle between successive subspaces as a fraction of a right angle (default 0.005, as in the paper), the cut-offs of the score and orthogonal distances are at the 99% level as in the paper, the residual scales are 1-step M scales, and the fit returns the observations set aside by DDC (flagged_rows).
Bug fixes
baseline_lsp()uses the improved modified polynomial fit (IModPoly) of Zhao et al. (2007) by default (method = "imodpoly"). The modified polynomial fit of Lieber and Mahadevan-Jansen (2003), still available withmethod = "modpoly", is pulled up by strong lines, and its baseline could then fall far below the background at the ends of the spectrum (for example above 290 nm in the 240-300 nm window of theforageLIBSspectra). The defaultmax.iteris now 100.
Dependencies
ggsci,prospectrandXICORmove from Imports to Suggests.generalized_boxplot()uses the default ggplot2 palette whenggsciis not installed, andcorrelation(method = "chatterjee")asks forXICOR.y_gradient_glsw()computes its Savitzky-Golay derivatives with the package's own filter (same results).mtis no longer suggested.- Every
step_*()function checks thatrecipesis installed.
Documentation
- Examples for the help pages that had none (the
step_*()functions,predict()methods,reject_shots(),pds(),robust_bcyj(),umad(), the wavelength calibration helpers and the tuning parameters). - The
rospca()example runs on a spectral window, and theplot_loadings()example that queries the NIST database is run with\donttestandtry(). - The package description covers the whole workflow, with references.
- Non-ASCII mathematical symbols removed from the help pages.
From NEWS.md in the release
Install
Health
- OK12 OKNow
- OK6 OK2026-10-16
Documentation
- Help pages
- 141 (3 internal)includes a package overview page
- Examples that run
- 93%129 run in a plain check (30 of them under a condition) · 9 only when donttest examples are enabled (R CMD check --as-cran)
- Exported functions with examples
- 98%
- Documented parameters
- 98%
- Return-value docs
- 100%
- Help pages citing references
- 43%
Downloads
Repository
- PRs merged (all time)
- 100%
- Median days to close, 50 most recently updated closed issues
- not measured
- Median days to close, 50 most recently updated closed PRs
- 0
Releases over time
Commits over time
11 development-tooling and community-health practices detected across 6 families in the upstream repository
Checks run against github.com/christiangoueguel/specproc on 2026-10-18.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-10-05 · The repository has a site deploy workflow
pkgdown site last built 2026-10-05, before release 0.8.3 (2026-10-15)
Show all practicesHide 2 practices
Dependencies
Code & Tests
Datasets
People & History
- 0.8.3Latest2026-10-15 · current release ·
12 days in CRAN's queue
Listed in CRAN's incoming queue from 2026-10-03 21:57 to 2026-10-15 12:21 UTC, in 52 readings. - RR 4.6.0 released · 2026-04-24
Package metadata
- First published
- 2026-10-15
- Total releases
- 1 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.1.0
- Bundled data
- 3.2 MB / 1 file
- Download size
- 4.7 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("specProc")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-21, which the citation names so these numbers can be found later. More on citing and the projects behind them.