jonesor / Rcompadre

R tools for obtaining and manupulating data from the COMPADRE and COMADRE Plant and Animal Matrix Databases
https://jonesor.github.io/Rcompadre/
11 stars 11 forks source link

Combine different mpm summaries into one function. #138

Closed darrennorris closed 1 year ago

darrennorris commented 1 year ago

Update to mpm_summaries. Combines different summaries into one function. If this follows the direction you see, I should be able to add functions to calculate CV and range.... Best, Darren

jonesor commented 1 year ago

Hi Darren, Sorry - I only just noticed this pull request! The notification slipped me by. I like the streamlined approach, but I won't be able to pull this modification on this occasion.

As the package stands, there are now two "types" of summary functions: mat_X and mpm_X (e.g. mat_mean and mpm_mean). The mat_x functions take lists of matrices as inputs, while the mpm_x functions take lists of CompadreMat objects.

We need to keep those two types of functions working for backwards compatibility to existing code.

I will work in the next version to make streamlined generic functions (mat_summary and mpm_summary which similarly take either (i) lists of matrices (ii) lists of CompadreMat objects or (iii) a whole CompadreDB object. The function will evaluate the input type and act appropriately.

After doing that I can officially deprecate the other functions using the standard approach (https://devguide.ropensci.org/evolution.html#functions-deprecate-defunct)