FRBCesab / funbiogeo

:package: R package to help with analyses in functional biogeography
https://frbcesab.github.io/funbiogeo/
GNU General Public License v2.0
10 stars 1 forks source link

What should we return when no sites were found with specified trait coverage? #3

Closed Rekyt closed 2 years ago

Rekyt commented 3 years ago

I'm working on the fbg_filter_trait_coverage() function which allows user to filter its site-species matrix according to a trait coverage threshold. Let's say for example "retain all the sites with a trait coverage >= 75%" meaning that all the sites for which abundance/summed presence of species in the trait data represent at least 75% of the total are retained.

However if no such sites are found, what should we return? Should it be NULL? A matrix(nrow = 0, ncol = 0) object? An error? For the moment it'll be NULL but it would be good to give a thought and justify this choice.

ahasverus commented 3 years ago

I implemented the return as data.frame(nrow = 0, ncol = ncol(input)). I think it's much more explicit...

Rekyt commented 2 years ago

This should be done for all the filter_* functions and added in tests