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

`s_mean()`, `s_median()`, etc. need a specialization for class `generic_spct` #32

Closed aphalo closed 2 weeks ago

aphalo commented 1 month ago

These methods are currently only implemented for collections of spectra. Adding support for multiple spectra in long form would be useful and simple. For example, for s_mean():

s_mean.generic_spct <- function(x, trim = 0, na.rm = FALSE, ...) {
   if (getMultipleWl(x) > 1L) {
     s_mean(subset2mspct(x), trim = trim, na.rm = na.rm, ...)
   } else {
     x
   }
}
aphalo commented 2 weeks ago

Implemented