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

Think about message when species have only NA traits #40

Closed Rekyt closed 2 years ago

Rekyt commented 2 years ago

Currently the message is written at the beginning:

head(
    funbiogeo::fb_filter_species_by_traits_coverage(
        funbiogeo::species_traits, threshold_traits_proportion = 0.5
    )
)
#> Some species have only NA values for all traits. Maybe you would like to remove them.
#>    species adult_body_mass gestation_length litter_size max_longevity
#> 1   sp_001       461900.76           235.00        1.25         324.0
#> 2   sp_002           21.11            19.89        5.64          48.0
#> 5   sp_005           31.60            24.50        4.94          48.0
#> 6   sp_006           21.90            23.68        5.16          52.8
#> 9   sp_009          903.98            39.25        2.50          84.0
#> 10  sp_010            8.31               NA        1.73         252.0
#>    sexual_maturity_age diet_breadth
#> 1               668.20            1
#> 2                76.04           NA
#> 5                43.27           NA
#> 6                57.93            4
#> 9                   NA            3
#> 10                  NA            1

Created on 2022-06-18 by the reprex package (v2.0.1)

However, it would probably make more sense to output AFTER the filtering.

ahasverus commented 2 years ago

An additional suggestion: maybe this message can also be printed in the functions fb_count_*()

ahasverus commented 2 years ago

In fact this message can be moved to the functions fb_count_*()

Rekyt commented 2 years ago

Actually the more I think about the message the less clear it is.

If it's in the count_*() functions, for when a species has only NA or a trait only NAs or a site only NA/0 it can be useful to notice. However, if it's inside the filter_*() functions, then we get the message before the filtering action that, most probably, will remove the species/traits/sites.

If we move the message into the count_*() functions it will be also displayed in the calls to filter_*() functions.

I'm happy to get your opinion on this. Do you think it's still a useful message to output? If yes, in which case?

ahasverus commented 2 years ago

Yes... In my head, the purpose of this message was to inform users that some entity (site, species, trait) has only NA (or no variability). And then users can remove manually those entities. But as it is the purpose of the functions fb_filter_*(), it is useless. However, can it be useful to print some messages inside fb_filter_*() to inform users on how many entities have been removed/kept?

ahasverus commented 2 years ago

Close as fixed by #60