aphalo / photobiology

Package ‘photobiology’ defines a system of classes for storing spectral data and accompanying methods and operators. This is the core of a suite of R packages for photobiological calculations.
4 stars 1 forks source link

Unnesting of spectra within mspct objects #11

Closed aphalo closed 1 year ago

aphalo commented 1 year ago

Collections of spectra containing spct objects with multiple spectra in long form trigger errors in summary functions like q_irrad(), q_ratio(), etc. The error message from plyr::ldply() is obscure, and unhelpful. At the very least an informative message is needed. Best solution would be to write a function to unnest these spectra, by replacing the spct object by multiple spct objects within the collection. This could be an exported function. By default, applied with a warnig or message. See also #12 as they both affect similar use cases and the solution should solve also mixed cases.

aphalo commented 1 year ago

Implemented by supporting collections of spectra as input to subset2mspct() and supporting spct objects containing multiple spectra as members of mspct objects passed as input to rbindspct(). No new functions or change in function signatures was needed.