rmaia / pavo

tools for the analysis of color data in R
http://pavo.colrverse.com
GNU General Public License v2.0
68 stars 17 forks source link

stitch.rspec function for row-wise merging #249

Open thomased opened 1 year ago

thomased commented 1 year ago

Function for stitching (row-merging) rspec objects of differing wavelength ranges. It has functionality for handling specs with partly-overlapping wl regions (averaging, min, max), as well as non-overlapping wl regions (via interpolation). Can handle rspec objects when the spec names match in each but are in a different order, or when they contain only some common samples (with the other being NA filled for the relevant wl region). Edit: whoops, didn't realise it'd contain the entire commit history for #247 too.

Bisaloo commented 1 year ago

Function name? I'm still slightly confused on the whole method/generic thing in this case. Ideally it'd be stitch.rspec().

Here is the general gist:

#' @export
stitch <- function(x1, x2, ...) {
  UseMethod()
}

#' @export
stitch.rspec <- function(x1, x2, ...) {

}

Success can be verified by the presence of a S3method() line in NAMESPACE. E.g.,

https://github.com/rmaia/pavo/blob/b1144fdadf5b474347aa5d8ec1146d74ec60a93b/NAMESPACE#L12