Vis-NIR Spectral Analysis Wrapper
Overview
Originally designed application in the context of resource-limited plant research and breeding programs, 'waves' provides an open-source solution to spectral data processing and model development by bringing useful packages together into a streamlined pipeline. This package is wrapper for functions related to the analysis of point visible and near-infrared reflectance measurements. It includes visualization, filtering, aggregation, preprocessing, cross-validation set formation, model training, and prediction functions to enable open-source association of spectral and reference data. This package is documented in a peer-reviewed manuscript in the Plant Phenome Journal doi:10.1002/ppj2.20012. Specialized cross-validation schemes are described in detail in Jarquín et al. (2017) doi:10.3835/plantgenome2016.12.0130. Example data is from Ikeogu et al. (2017) doi:10.1371/journal.pone.0188918.
- Bug fix: Fixed namespace resolution error with
lifecycle::deprecated()function calls that was causing "could not find function deprecated" errors for users. All function parameters now properly uselifecycle::deprecated()instead ofdeprecated(). - Bug fix:
train_spectra()now correctly populatesRMSEcvandR2cvforrf,svmLinear, andsvmRadialmodel methods. Previously these were alwaysNAfor non-PLS models. - Bug fix: Replaced deprecated tidyr and dplyr functions across
plot_spectra(),aggregate_spectra(),train_spectra(), and theikeogu.2017example to resolve deprecation warnings. - Internal: Fixed
trainControl()configuration intrain_spectra()— changedmethodfrom"repeatedcv"(with no repeats set) to"cv"and removed a malformedseedsargument that was being silently ignored. Reproducibility is maintained via the existingset.seed()call. - Bug fix: The final RF model returned by
train_spectra()is now trained with 500 trees (the randomForest default) instead oftune.length(≤5). The tunedmtryfrom training iterations is now correctly applied to the final model. - Bug fix: The final SVM model returned by
train_spectra()no longer incorrectly uses theunique.idcolumn as a predictor. Training data is now subset to reference and spectral columns only, consistent with iterative model training. - Bug fix: The final PLS model returned by
train_spectra()is now fit using the modal bestncompfrom training iterations rather thantune.length.predict_spectra()now readsncompdirectly from the model object instead of the stats file. - Bug fix:
train_spectra()now correctly subsets partitioned data using column names rather than pre-computed indices, preventing anundefined columns selectedcrash whencv.schemeis used (the genotype column is removed byformat_cv()before subsetting). - Bug fix:
train_spectra()now correctly determines the training data for the final model whencv.schemeis used. It callsformat_cv()one final time to obtain the training set defined by the chosen scheme: CV0/CV00 train on trial2 + trial3; CV1 trains on t1.b + t2.b; CV2 trains on t1.b + trial2. In all schemes the test set is t1.a (held-out genotypes from trial1). - Bug fix:
test_spectra()now correctly forwardsbest.model.metricandseedtotrain_spectra(). Previously these arguments were accepted but silently ignored. - Bug fix:
train_spectra()now callsset.seed()beforecreateDataPartition(), ensuring that stratified train/test splits are fully reproducible. Previously,set.seed()was called aftercreateDataPartition(), so the partition depended on whatever the random state happened to be at call time. **Note on reproducibility:** users who calledtest_spectra()with a non-defaultseedwere previously receiving results generated withseed = 1regardless of the value they set. To reproduce old results, setseed = 1explicitly. This will restore previous iterative performance statistics (RMSEp, R2p, etc.), but the returned$modelobject will still differ due to the RF, SVM, and PLS final model fixes also introduced in this version. - Bug fix: Removed invalid
ntreeandmtryarguments frompredict.randomForest()calls intrain_individual_model()andpredict_spectra(). These arguments are not accepted bypredict.randomForest()and were silently ignored.
Show all changes in 0.2.7Hide the rest of the changes in 0.2.7
- Bug fix: Fixed corrupted
importanceoutput when runningtest_spectra()with multiple pretreatments and an SVM model. Previously,cbind()on aNULLimportance element produced a garbage 1×1 matrix instead ofNULL.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-04
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-06-09
- ERROR12 OK, 1 ERROR2026-06-08
- NOTE12 OK, 1 NOTE2026-06-07
Show 3 earlier changesHide 3 earlier changes
- OK13 OK2026-05-02
- ERROR11 OK, 1 ERROR2026-04-25
- OK14 OK2026-03-10
Documentation
- Help pages
- 11 (1 internal)
- Examples that run
- 50%5 run in a plain check · 4 only when donttest examples are enabled (R CMD check --as-cran) · 1 never run
- Exported functions with examples
- 90%
- Documented parameters
- 90%
- Return-value docs
- 90%
- Help pages citing references
- 27%
- waves HTML
Downloads
Repository
- PRs merged (all time)
- 100%
- Median days to close, 50 most recently updated closed issues
- 43
- Median days to close, 50 most recently updated closed PRs
- 0
Stars over time
Forks over time
Releases over time
Issues over time
PRs over time
Commits over time
10 development-tooling and community-health practices detected across 6 families in the upstream repository
Checks run against github.com/gorelab/waves 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-07-28 · The repository has a site deploy workflow
pkgdown site last built 2026-06-02
Show all practicesHide 2 practices
Dependencies
Code & Tests
Datasets
People & History
Pick two releases to compare their code metrics.
- 0.2.7Latest
- RR 4.6.0 released · 2026-04-24
- unarchivedReturned to CRAN2025-10-31
- 0.2.62025-10-31 · diff ↗
- archivedRemoved from CRAN2025-06-02requires archived package 'spectacles'
- RR 4.5.0 released · 2025-04-11
- RR 4.4.0 released · 2024-04-24
- 0.2.52023-12-12 · diff ↗
- RR 4.3.0 released · 2023-04-21
- RR 4.2.0 released · 2022-04-22
- 0.2.42022-03-29 · diff ↗
- 0.2.32022-03-07 · diff ↗
- 0.2.22022-02-18 · diff ↗
- 0.2.12022-02-03 · diff ↗
- 0.2.02022-01-21 · diff ↗ ·
added 9 exports
aggregate_spectra, filter_spectra, format_cv, plot_spectra, predict_spectra, pretreat_spectra, save_model, test_spectra, train_spectra - RR 4.1.0 released · 2021-05-18
Package metadata
- First published
- 2020-09-17
- Total releases
- 10 / 6 yrs
- License
- MIT + file LICENSE OSI
- Minimum R
- ≥ 4.1.0
- Bundled data
- 1.9 MB / 1 file
- Download size
- 2.9 MB
Cite
Cite this package
Run in R for the authors' entry:
citation("waves")The package provides a citation file, so citation() returns the authors' own entry.
It points to 10.1002/ppj2.20012.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-22, which the citation names so these numbers can be found later. More on citing and the projects behind them.