NEWS.md

specProc 0.9.0

New features

Improvements

The help page gives the sizes for journal figures. The colors of colvar now go from dark purple to yellow-green (viridis), instead of from blue to red, readable by colorblind readers and in grayscale; use palette = c("blue", "red") for the former colors. The axis lines are slightly thinner. adjusted_boxplot() and generalized_boxplot() make figures ready for publication: - each variable is drawn in its own panel, with its own value axis (scales = "free_y", the default), so that variables of different scales stay readable; scales = "fixed" keeps a common axis; - group draws the boxes of groups (sites, treatments, ...) side by side, and id names the observations: the outliers table gives the row and id of every outlying value, and label_outliers labels them; - the number of values is written below each box (show_n), and show_mean marks the means; - points = "all" draws every observation ("outliers" by default, spread sideways so that equal values do not hide each other, or "none"); - a caption names the boxplot and its whiskers, which readers would take for Tukey's otherwise (caption); the help pages give a figure legend; - xlab, ylab, title (bold), base_size, horizontal, log (a logarithmic axis) and fill (one color, or one per group or variable); - the stats table gives n, the fences, the notch limits, the mean and n_outliers of each variable (and group); - annotate writes statistics with each box: the shape measured by the method (medcouple, or g and h), the number of flagged values with the number expected in clean data, the median with its distribution-free 95% confidence interval, the IQR and the robust coefficient of variation; it draws the fences and the biweight location, gives the p-value of a Kruskal-Wallis test between the groups, and the number of missing values. The stats table gains these values (n_missing, median_lower, median_upper, iqr, rcv, biweight, expected_outliers), and a tests table gives the tests. plot_outliers() makes figures ready for publication: readable variable names, a "Robust z-score" axis, outliers in red among grey samples ("Regular" and "Outlier"), dashed univariate limits (z = -2.5 and 2.5), and a caption saying how the outliers are flagged and how to read the plot. type = "distance" draws the robust distance of each sample with the cutoffs. id names the samples, in the table and with label_outliers; color_by ("outlier", "distance" or "both"), plot = FALSE (the table: row, id, distance, cutoff, outlier, weight and robust z-scores), title, ylab and base_size. Rows with missing values are left out, with a message, instead of stopping. plot_fit() gives, above each panel, the center, FWHM and area of each peak with their standard errors (rounded to two significant digits of them), and R^2 and RMSE. The FWHM of a Voigt profile combines its widths (Olivero and Longbothum, 1977), with a standard error from the covariance of the estimates. show_fwhm draws the FWHM at half maximum; the baseline is dotted, the peaks of a multi-peak fit are numbered, the residuals have dashed limits at plus or minus twice the RMSE, and a caption names the profiles. The data are small open circles, with a legend; xlab, ylab, base_size, ncol (several spectra: a pair of panels each) and caption are added. plot_embedding() makes figures ready for publication: plain axis numbers ("-100,000" rather than "-1e+05"); base_size, which scales the text, points, lines and labels; a caption saying what the ellipses and limits are; legend_title; a point shape per group (shapes), for grayscale printing; palette; aspect_ratio = "equal"; legend (position) and panel = "white". The labels of the flagged samples alternate above and below the points, and the short loadings of a biplot are drawn without labels, which overlapped near the origin. hotelling_t2() and plot_embedding() give the limit of a new sample, method = "new" (the F limit times (n + 1) / n). The docs no longer call the F limit the limit of a new sample. The axis titles of plot_spectra() and plot_fit() give the units in parentheses, as in the other plots: "Wavelength (nm)" and "Intensity (arb. units)". wavelet_features() keeps the wavelengths: when the names of the spectra are wavelengths, the attribute "wavelength" of the coefficients gives the wavelength at the center of the window of channels of each one (the centroid of its weights for the approximation, their center of energy for the details, which are not centered on the block of 2^level channels: about 37 channels later for "la8" at level 4). tidy() of step_wavelet() gains the wavelength of the kept coefficients, to trace them back to the spectrum. A named vector now keeps its names. specProc now requires ggplot2 3.5.0 or later. scales moves from Suggests to Imports, since the plots use it; it was already installed with ggplot2. The examples of zscore(), iqr_outliers() and directional_outlyingness() start with synthetic data whose outliers are known, drawn as a density plot: a cluster of outliers that hides itself from the classical z-score (masking), and a right-skewed sample with low and high outliers, on which the fences that account for the skewness and the directional outlyingness flag the outliers and no regular value of the long tail.

Breaking changes

The fits of robpca(), rospca(), macropca() and cellpca() keep their number of components in ncomp instead of k, and the results of q_residuals(), dmodx() and contributions() in the attribute ncomp: code that reads fit$k now gets NULL. The k of iqr_outliers(), the fence factor, keeps its name. rospca() chooses its number of components when ncomp is not given, as robpca(): the smallest number that explains var_explained (new, 0.8) of the variance of the least outlying observations, with at most ncomp_max (new, 10). ncomp was 2 by default; rospca(x, ncomp = 2) gives the former result. generalized_boxplot() flags fewer observations: its default detection rate alpha is now about 0.7% (2 * pnorm(-4 * qnorm(0.75))), that of Tukey's boxplot for normal data, as in the authors' implementation (the Stata command robbox), instead of 5%. With 5%, about 18 of the 368 forageLIBS samples were flagged per mineral even in clean data; use alpha = 0.05 for the former fences (see also the bug fixes). adjusted_boxplot() and generalized_boxplot() draw one panel per variable, boxes in light grey (the colors of each variable added nothing, and depended on whether ggsci was installed) and horizontal labels. scales = "fixed" and fill give the former layout and colors. The arguments xlabels.angle, box.width, notchwidth and staplewidth of adjusted_boxplot() and generalized_boxplot() are renamed x_labels_angle, box_width, notch_width and staple_width, and xlabels.hjust and xlabels.vjust are deprecated (the justification follows the angle). The former names still work, with a warning. The outliers table of adjusted_boxplot() has the columns row and out (the tail), as that of generalized_boxplot(). reject_shots() (and step_reject_shots()) rejects far fewer regular shots. With the few shots of a sample, the MAD of the sample is unstable: shots that differed by little from very similar shots got large z-scores, and the correlations near 1, bounded and skewed, made small differences look extreme. On the 2944 shots of the forage data set, 235 shots were rejected, many with a correlation above 0.99 with the median spectrum of their sample; in simulations, 2.5% to 5% of regular shots were. The z-scores of the correlation are now those of Fisher's z, the intensity and the distance are on a log scale, and the scale of a sample is its MAD but not less than the pooled MAD of all the samples (scale = "floor", the default; "sample" and "pooled" are the others): 10 shots of the forage data set are rejected (weak or strong plasmas of other shapes), and 0.1% to 0.5% of regular shots in simulations, while the shots of a plasma weakened by a quarter or more are still detected. The result also gives the shot number .shot (new argument shot), the raw criteria .intensity (relative to the median shot of the sample), .correlation and .distance, and its settings. The arguments of the points and lines of plot_fit() are renamed point_size, point_color, linewidth and fit_color (from pt.size, pt.colour, line.size and line.colour); pt.shape, pt.fill, linetype and the resid.* arguments are deprecated and ignored. plot_outliers() flags the samples beyond the adaptive cutoff of Filzmoser, Garrett and Reimann (2005), as aq.plot() of the mvoutlier package, instead of the fixed 97.5% chi-squared quantile, which flags about 2.5% of clean data (the adaptive part had no effect: the cutoff was the smaller of the two). In forageLIBS, 29 of the 368 samples are flagged on Ca, Mg, P and K instead of 38. cutoff = "quantile" gives the former flags. show.outlier and show.mahal are deprecated in favor of color_by and plot = FALSE, and the table gains the columns row, cutoff and weight. * Plot arguments are renamed to the names shared by the plots (see Improvements). The former names still work, with a deprecation warning: - plot_spectra(.interactive) becomes interactive; - plot_outlier_map(colour_by) and plot_influence(colour_by) become color_by, and plot_som(colour) becomes color_by; - plot_embedding(colour, size, alpha) become color_by, point_size and point_alpha. A number in point_size is the size of the points; the default, and a number in the former size, scale with base_size.

The sizes and opacities of the points of plot_outlier_map(), plot_influence() and plot_coomans() can still be given in ... (size, alpha), as other arguments of ggplot2::geom_point(). The loadings of robpca() now have a fixed sign, their largest element positive, as those of macropca() and cellpca(). The signs of loadings and scores may differ from those of earlier versions. robust_bcyj() and step_robust_bcyj() are deprecated in favor of robust_boxcox(), robust_yeojohnson() and their recipe steps (see New features). They still work, with a deprecation warning, and the recipes trained with step_robust_bcyj() can still be baked. Their default, type = "bestObj", chose Box-Cox or Yeo-Johnson for each variable by a difference in fit that is often negligible (each for about half of the forageLIBS channels), and mixed two scales of lambda. The defunct robustBCYJ() now names the new functions. The functions of a single variable (biweight_location(), biweight_scale(), biweight_midvariance(), umad(), iqr_outliers(), medcouple_weight(), quantile_weight(), zscore(), minmax() and directional_outlyingness(), as medcouple()) stop when x is a matrix, instead of pooling all its values into one result (one location of all the channels of a set of spectra, for example). The message shows how to get one result per column, with sapply(x, f) for a data frame or apply(x, 2, f) for a matrix. Data frames already gave an error. directional_outlyingness() flags the observations whose score exceeds the (1 + cutoff_quantile) / 2 quantile of the standard normal distribution (2.81 by default), about 0.5% of the observations of a normal distribution. The cutoff came from a robust normal fit to log(0.1 + score): on one variable it lay near 5 to 6 scales from the median, so that no observation of normal data was flagged, nor, in a right-skewed sample, a high outlier at 6 scales or low outliers below the distribution. More observations are flagged. cutoff_quantile must be strictly between 0 and 1. The scales of the two half samples now follow equation (2) of Rousseeuw, Raymaekers and Hubert (2018) exactly, with the consistency constant alpha of Huber's rho function instead of a rounded one: the scores are 0.4% higher, and the help page gives the formula.

Bug fixes

specProc 0.8.3

New features

Breaking changes

Bug fixes

Dependencies

Documentation

specProc 0.8.1

Bug fixes

specProc 0.8.0

Breaking changes

New features

Plots

Documentation

specProc 0.7.0

Performance

Breaking changes

New features

Bug fixes

specProc 0.6.0

New features

specProc 0.5.0

This release adds plasma diagnostics for LIBS: electron density from Stark broadening, excitation temperature from Boltzmann and Saha-Boltzmann plots, and checks of LTE, self-absorption and detector saturation, with atomic data from the NIST Atomic Spectra Database and Stark parameters from STARK-B.

New features

specProc 0.4.0

This release adds robust PCA, a proper net analyte signal with figures of merit, and rewrites the documentation around tidymodels.

Breaking changes

New features

Documentation

specProc 0.3.0

This release connects specProc to the tidymodels framework. Preprocessing and orthogonalization can now be estimated on calibration data and applied to new spectra, either directly with predict() or as recipe steps that are re-estimated on every resample and tuned together with the model.

New features

specProc 0.2.0

This release fixes a large number of bugs so that every exported function now runs and returns numerically correct results. It adds a test suite (400+ expectations), and several results are checked against independent reference implementations.

Breaking changes

Bug fixes

New features

Improvements

specProc 0.1.0



Try the specProc package in your browser

Any scripts or data that you put into this service are public.

specProc documentation built on Nov. 20, 2026, 5:11 p.m.