red-list-ecosystem / redlistr

redlistr: Tools for the IUCN Red List of Ecosystems and Species
Other
31 stars 6 forks source link

Implement generic functions to calculate AOO and EOO from different objects #13

Closed jrfep closed 2 years ago

jrfep commented 2 years ago

I think the most elegant solution would be to implement a generic function:

makeAOO <- function (object, ...)
UseMethod("makeAOO")

And then have methods to handle different spatial objects.

Need to explore some background/tutorials for this:

calvinkflee commented 2 years ago

@jrfep I agree that's probably the best way forward, and can help clean up some of the other code as well. Right now I just have a very simple (and messy) If statement at the beginning of some of the functions that it runs through, and an error that can't be interpreted properly if the input format isn't included in that list.

Are you working on this? Otherwise I think I might be able to get something up and tested relatively quickly!

jrfep commented 2 years ago

Hi @calvinkflee, Thanks, that is great! I was thinking about this, but haven't got time to actually implement it. Will try to find some time to review the code.