waves 0.2.7
CRAN release: 2026-06-02
- 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. - 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.
waves 0.2.6
CRAN release: 2025-10-30
- Bug fix:
plot_spectra()no longer returns an error whendetect.outliersis set toFALSEand no alternative title is provided via thealternate.titleparameter (#29). - Bug fix: Fixed compatibility issue with updated
spectaclespackage (v0.5.5) that was causing data frame construction errors in model performance calculations. - Fixed: Temporary CRAN archive issue with the dependency
spectaclesresolved (#31).- The dependency
spectaclesis now restored on CRAN. -
wavesis fully compatible with the restored version.
- The dependency
- Performance improvements:
- Optimized cross-validation loops in
train_spectra()using vectorized indexing and preallocated result structures. - Optimized matrix operations in
train_spectra()for faster column selection and reduced memory overhead. - Added shared utility functions to eliminate code duplication between
train_spectra()andtest_spectra().
- Optimized cross-validation loops in
- When
return.distances = TRUE, the h.distance column is now located between metadata and spectra in the returneddata.frame(#28). - Internal code improvements:
- Significantly refactored
train_spectra()andtest_spectra()to reduce cyclomatic complexity (#26).-
train_spectra()complexity reduced from 32+ to 25 -
test_spectra()complexity reduced to 11
-
- Extracted shared utility functions:
handle_deprecations(),validate_inputs(),partition_data(),train_individual_model(),calculate_performance(), andcreate_cv_control(). - Improved code maintainability and reduced duplication through function decomposition.
- Added robust error handling for spectacles package compatibility.
- Significantly refactored
waves 0.2.5
CRAN release: 2023-12-12
- Bug fix:
predict_spectra()no longer returns error when running example code (#25).
waves 0.2.4
CRAN release: 2022-03-29
- Bug fix: Different CV schemes no longer return the same results (#20).
- When
cv.schemeis set to “CV2” and “CV0” and there are no overlapping genotypes between “trial1” and “trial2”,format_cv()now returnsNULL. Previously, results would be returned even if no overlap was present, resulting in incorrect CV scheme specification. -
format_cv()parametercv.methodis now the boolean parameterstratified.samplingfor consistency with other waves functions. -
plot_spectra()no longer requires a column named “unique.id”.
waves 0.2.3
CRAN release: 2022-03-07
- Bug fix:
save_model()output now works correctly withpredict_spectra(). - Bug fix:
train_spectra()no longer returns an error whenstratified.sampling = F. - In
train_spectra(), stratified random sampling of training and test sets now allows the user to provide a seed value forset.seed(). For random (non-stratified) sampling of training and test sets, seed is set to the current iteration number. - Minor documentation updates added.
waves 0.2.2
CRAN release: 2022-02-18
- Bug fix:
model.method = "svmLinearandmodel.method = "svmRadialno longer return an error when used intrain_spectra()ortest_spectra().
waves 0.2.1
CRAN release: 2022-02-03
- Bug fix:
test_spectra()now returns trained model correctly when only one pretreatment is specified. - Change the gap-segment derivative pretreatment to retain compatibility with prospectr. In the upcoming version of prospectr, the gapDer function only accepts odd values for the segment argument in order to properly compute the convolution filter.
- Default plot title for
plot_spectra()is nowNULL(no title) ifdetect.outliersis set toFALSE. - Column names in output list item
$summary.model.performancefromtest_spectra()now include underscores rather than periods for easier parsing. - Update website
- New vignette:
vignette("waves")
waves 0.2.0
CRAN release: 2022-01-21
- Update all files to conform to the tidyverse style guide (#6).
- All functions renamed to match tidystyle. Old functions names work will be dropped after this version:
-
AggregateSpectra->aggregate_spectra() -
DoPreprocessing->pretreat_spectra() -
FilterSpectra->filter_spectra() -
FormatCV->format_cv() -
PlotSpectra()->plot_spectra() -
SaveModel()->save_model() -
TestModelPerformance()->test_spectra() -
TrainSpectralModel()->train_spectra()
-
- “Preprocessing” has been renamed “Pretreatment” to minimize confusion with physical preprocessing of samples prior to scanning. Arguments have been renamed to reflect these changes (
preprocessingis nowpretreatment). - Added more informative error message and documentation for random forest tune length (
tune.lengthmust be set to 5 whenmodel.algorithm == "rf"). - Additional flexibility for
plot_spectra()including color and title customization and the option to forgo filtering (#5). - Named list output for all functions to enable easier access to individual elements.
- Always return model and variable importance results with
train_spectra()andtest_spectra(). - Add variable importance for PLSR (#9).
- Enable selection of k for k-fold cross-validation within the training set. Previously, k was fixed at 5 (#10).
-
save_model()now automatically selects the best model if provided with multiple pretreatments. - Code simplified and streamlined to facilitate future updates.
- Export predicted values as well as performance statistics for each training iteration (#11).
-
wavelengthsis no longer a required argument for any of the waves functions. - The proportion of samples to include in the training set can now be selected with the argument
proportion.train. Previously, this proportion was fixed at 0.7 (#13). - Bug fix:
aggregate_spectra()now allows for aggregation by a single grouping column (#14). - The parameter
save.modelin the functionsave_model()has been renamed towrite.modelfor clarity.
waves 0.1.1
CRAN release: 2021-04-21
- Bug fix: SVM Linear and SVM Radial algorithms no longer return errors in
TrainSpectralModel(). - Bug fix: Random Forest variable importance no longer returns error in
TrainSpectralModel()or whenpreprocessing = TRUEinTestModelPerformance()(#7). - Output for random forest variable importance now includes “Pretreatment” and “Iteration” columns.
-
PlotSpectra()now allows for missing data in non-spectral columns of the input data frame. - waves now has an associated paper in the Plant Phenome Journal! The citation for this paper should be used if waves is used in a paper - see citation(“waves”) for details.
