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

Implement species categories (fix #15) #82

Closed Rekyt closed 1 year ago

Rekyt commented 1 year ago

This PR is a WIP to implement species categories (see #15) across funbiogeo especially the plotting function.

For now, I have the impression that it complexifies significantly the code. But there may be more efficient ways to do so. I'll progress plot function per plot function.

Current implementation in plotting functions:

Rekyt commented 1 year ago

For now, I've only implemented it in fb_plot_species_traits_completeness() and it retains the previous behavior.

library("funbiogeo")

fb_plot_species_traits_completeness(species_traits)


fb_plot_species_traits_completeness(
  species_traits,
  data.frame(species = species_traits$species,
             category = rep(letters[c(1, 2, 4)], each = 50)[-1])
)

Created on 2023-05-17 with reprex v2.0.2

Rekyt commented 1 year ago

One question I have for fb_plot_number_species_by_trait() and all the functions with thresholds: should the threshold be the same across facets (which is the case now?) or if it's a percent, should be compared to the values in the facets?

codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (16ce86a) 100.00% compared to head (135f4ee) 100.00%.

:exclamation: Current head 135f4ee differs from pull request most recent head 30450b8. Consider uploading reports for the commit 30450b8 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #82 +/- ## ========================================== Coverage 100.00% 100.00% ========================================== Files 35 35 Lines 1114 1330 +216 ========================================== + Hits 1114 1330 +216 ``` | [Impacted Files](https://app.codecov.io/gh/FRBCesab/funbiogeo/pull/82?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FRBCesab) | Coverage Δ | | |---|---|---| | [R/checks.R](https://app.codecov.io/gh/FRBCesab/funbiogeo/pull/82?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FRBCesab#diff-Ui9jaGVja3MuUg==) | `100.00% <100.00%> (ø)` | | | [R/fb\_get\_environment.R](https://app.codecov.io/gh/FRBCesab/funbiogeo/pull/82?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FRBCesab#diff-Ui9mYl9nZXRfZW52aXJvbm1lbnQuUg==) | `100.00% <100.00%> (ø)` | | | [R/fb\_get\_trait\_combination\_coverage.R](https://app.codecov.io/gh/FRBCesab/funbiogeo/pull/82?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FRBCesab#diff-Ui9mYl9nZXRfdHJhaXRfY29tYmluYXRpb25fY292ZXJhZ2UuUg==) | `100.00% <100.00%> (ø)` | | | [R/fb\_get\_trait\_coverage\_by\_site.R](https://app.codecov.io/gh/FRBCesab/funbiogeo/pull/82?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FRBCesab#diff-Ui9mYl9nZXRfdHJhaXRfY292ZXJhZ2VfYnlfc2l0ZS5S) | `100.00% <100.00%> (ø)` | | | [R/fb\_plot\_number\_species\_by\_trait.R](https://app.codecov.io/gh/FRBCesab/funbiogeo/pull/82?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FRBCesab#diff-Ui9mYl9wbG90X251bWJlcl9zcGVjaWVzX2J5X3RyYWl0LlI=) | `100.00% <100.00%> (ø)` | | | [R/fb\_plot\_number\_traits\_by\_species.R](https://app.codecov.io/gh/FRBCesab/funbiogeo/pull/82?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FRBCesab#diff-Ui9mYl9wbG90X251bWJlcl90cmFpdHNfYnlfc3BlY2llcy5S) | `100.00% <100.00%> (ø)` | | | [R/fb\_plot\_site\_traits\_completeness.R](https://app.codecov.io/gh/FRBCesab/funbiogeo/pull/82?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FRBCesab#diff-Ui9mYl9wbG90X3NpdGVfdHJhaXRzX2NvbXBsZXRlbmVzcy5S) | `100.00% <100.00%> (ø)` | | | [R/fb\_plot\_species\_traits\_completeness.R](https://app.codecov.io/gh/FRBCesab/funbiogeo/pull/82?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FRBCesab#diff-Ui9mYl9wbG90X3NwZWNpZXNfdHJhaXRzX2NvbXBsZXRlbmVzcy5S) | `100.00% <100.00%> (ø)` | | | [R/fb\_plot\_trait\_combination\_frequencies.R](https://app.codecov.io/gh/FRBCesab/funbiogeo/pull/82?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FRBCesab#diff-Ui9mYl9wbG90X3RyYWl0X2NvbWJpbmF0aW9uX2ZyZXF1ZW5jaWVzLlI=) | `100.00% <100.00%> (ø)` | | | [R/fb\_plot\_trait\_correlation.R](https://app.codecov.io/gh/FRBCesab/funbiogeo/pull/82?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FRBCesab#diff-Ui9mYl9wbG90X3RyYWl0X2NvcnJlbGF0aW9uLlI=) | `100.00% <100.00%> (ø)` | | | ... and [1 more](https://app.codecov.io/gh/FRBCesab/funbiogeo/pull/82?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=FRBCesab) | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

Rekyt commented 1 year ago

Let's close this for now, these remain to be done in a future PR:

ahasverus commented 1 year ago

One question I have for fb_plot_number_species_by_trait() and all the functions with thresholds: should the threshold be the same across facets (which is the case now?) or if it's a percent, should be compared to the values in the facets?

I would say it can be interesting to use an additional argument for that. This way the user can choose one amon the two options.