ropensci / canaper

Categorical Anaysis of Neo- and Paleo-endemism in R
https://docs.ropensci.org/canaper/
Other
7 stars 3 forks source link

Remove un-needed checks #5

Closed joelnitta closed 2 years ago

joelnitta commented 2 years ago

As described by @KlausVigo in his ROpenSci review

The canaper package uses defensive programming extensively (calling assertthat::assert_that), which is generally a very good thing. However, here are some exceptions: The functions calc_biodiv_random and cpr_rand_comm are only called internally and are called thousands of times inside of the loop. It should be save to remove all (most) of the calls to assertthat::assert_that from these functions as parameters have been checked already and are save to use! In fact the algorithm spent a similar amount of time in assertthat::assert_that than computing the biodiversity measures (phylo_endemism, PD).

(note that cpr_rand_comm() is not only called internally, but is also provided as a user-facing (exported) function)