Spectral Preprocessing and Chemometric Calibration of NIR Sensors
Overview
Provides tools to build quantitative chemometric models and applications for near-infrared (NIR) sensors. Chemometric regression models are based on partial least squares regression as described by Wold (1975) doi:10.1016/B978-0-12-103950-9.50017-4 and modified partial least squares regression as described by Shenk and Westerhaus (1991) doi:10.2135/cropsci1991.0011183X003100020049x, with further discussion by Westerhaus (2014) doi:10.1255/nirn.1492.
- Feat: new dataset
proxiscoutCannabis, containing absorbance spectra of 192 cannabis samples measured with three ProxiScout devices at the 257 standard ProxiScout wavenumbers, together with eleven cannabinoid reference variables (CBDA,CBG,CBD,CBN,THC,THCA,CBC,CBGA,CBD_total,THC_totalandCBGt). The set includes one deliberate outlier and adeviceIdcolumn usable asvalidation_group. - Deprecated: the dataset
NIRcannabiswas renamed toproximateCannabis, for consistency with the newproxiscoutCannabisdataset. The old name still works but is deprecated and will be removed in a future release. - Breaking: the dataset
NIRcannabiswas renamed toproximateCannabis, for consistency with the newproxiscoutCannabisdataset. The old name is kept as a deprecated copy and will be removed in a future release. - Docs:
proximateCannabisandproxiscoutCannabiscross-reference each other, noting that they share neither samples nor reference values. - Feat: validation results now include the Mahalanobis (GH) distance, computed from scaled PLS scores, and the spectral (X-space) residual for each sample. Both are returned by
calibrate_models()andvalidate_prediction()and are available for downstream analysis. - Feat:
plot.spectral_model()gained avalidation_groupargument to colour validation samples by group, for example by instrument. - Feat: new "Leverage vs. Spectral Residual" validation plot, showing each sample's leverage and spectral residual relative to their control limits (dashed line at 1), with grouped colouring.
- Feat:
predict.spectral_model()returns per-component control limits for the leverage (new-observation Mahalanobis limit) and spectral residual Q (calibration quantile), configurable viacontrol_limit_conf(default 0.99) and carried throughvalidate_prediction(). - Misc: group argument checking for
sample_groupandvalidation_grouprefactored into a single internal helper. - Fix:
predict.spectral_model()no longer misalignsnewdatawithprep_wav_trim(trim_constant_edges = TRUE); the trimmed band is resolved at calibration time and reapplied deterministically. - Fix: the
nwpfit method leftprojection_mout of its slope correction, so scores of new samples (and therefore their leverage and spectral residual) were wrong; predictions were unaffected. - Feat:
proxiscout_write_data()also writes a<prefix>_metadata.csvwith the sample names and any leftover columns.
Show all changes in 0.7.1Hide the rest of the changes in 0.7.1
- Fix:
proxiscout_write_data()renames the correctSNR/SRNcolumn todeviceIdand honours integerspc. - Fix:
proxiscout_write_data()now writes consistentsampleName/deviceIdheaders across all files (the spectra file previously usedSample Name/Device Id). - Tests: added unit tests for
proxiscout_write_data(). - Fix:
proxiscout_read_data()now treats"","-"and"NA"as missing values when reading CSV and XLSX files, so numeric columns using these placeholders are read as numeric. - Fix:
extract_property_names()no longer returns the internal.repetition_groupcolumn as a property forproxiscout_data. - Tests: added unit tests for
extract_property_names()and the missing-value handling inproxiscout_read_data(). - Docs: documented the new arguments, validation statistics and plot, including in
model_plot_template.qmd.
From NEWS in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK6 OK2026-07-01
Documentation
- Help pages
- 75 (37 internal)includes a package overview page
- Examples that run
- 56%14 run in a plain check · 10 only when donttest examples are enabled (R CMD check --as-cran) · 1 hold no code
- Exported functions with examples
- 73%
- Documented parameters
- 96%
- Return-value docs
- 100%
- Help pages citing references
- 4%
- An introduction to the proximetricsR package HTML
- Mathematical overview of regression algorithms HTML
- ProxiMate: Building applications HTML
- ProxiMate: Structure of the applications HTML
- ProxiScout: Building applications HTML
- ProxiScout: Structure of the applications HTML
- Read and recalibrate application HTML
- Spectral pre-processing recipes HTML
Downloads
Repository
- PRs merged (all time)
- 75%
- Median days to close, 50 most recently updated closed issues
- 1
- Median days to close, 50 most recently updated closed PRs
- 1
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
Commits over time
- github.com/l-ramirez-lopez/proximetricsr · last recorded on 2026-08-04
9 development-tooling and community-health practices detected across 5 families in the upstream repository
Checks run against github.com/buchi-labortechnik-ag/proximetricsr on 2026-10-21.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
GitHub Pages site last deployed 2026-09-28 · The repository has a site deploy workflow
Show all practicesHide 1 practice
Dependencies
Installing proximetricsR adds 83 packages (42 with compiled code, 77 MB of source tarballs). Heaviest: stringi 11 MB, prospectr 6.2 MB, ggplot2 6.0 MB.
Code & Tests
Datasets
People & History
Pick two releases to compare their code metrics.
- 0.7.1Latest
- 0.7.0
- 0.6.52026-07-17 · diff ↗
- 0.6.42026-06-30
- RR 4.6.0 released · 2026-04-24
Package metadata
- First published
- 2026-06-30
- Total releases
- 4 / 1 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.2.0
- Bundled data
- 607 KB / 3 files
- Download size
- 3.8 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("proximetricsR")The package provides a citation file that builds its entry when R runs it. Run citation() to see it.
The repository also keeps a CITATION.cff.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-25, which the citation names so these numbers can be found later. More on citing and the projects behind them.