EvolEcolGroup / tidysdm

R package to fit species distribution models (SDMs) using the 'tidymodels' framework
https://evolecolgroup.github.io/tidysdm/
GNU Affero General Public License v3.0
28 stars 8 forks source link

Bug fix to coordinate columns in thin_by_cell #20

Closed japilo closed 1 year ago

japilo commented 1 year ago

I was having problems with a sf data object that already had its coordinates stashed in X, Y columns, so I added some code to check if the correct coordinates are already there as X, Y. If they are, the sf coordinates are not bound. If there are X and Y columns that don't match the coordinates, they are replaced with a warning.

codecov[bot] commented 1 year ago

Codecov Report

All modified lines are covered by tests :white_check_mark:

Comparison is base (5aedb1c) 90.21% compared to head (5211984) 90.28%.

:exclamation: Current head 5211984 differs from pull request most recent head 9be1b10. Consider uploading reports for the commit 9be1b10 to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #20 +/- ## ========================================== + Coverage 90.21% 90.28% +0.06% ========================================== Files 52 52 Lines 1196 1204 +8 ========================================== + Hits 1079 1087 +8 Misses 117 117 ``` | [Files](https://app.codecov.io/gh/EvolEcolGroup/tidysdm/pull/20?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=EvolEcolGroup) | Coverage Δ | | |---|---|---| | [R/thin\_by\_cell.R](https://app.codecov.io/gh/EvolEcolGroup/tidysdm/pull/20?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=EvolEcolGroup#diff-Ui90aGluX2J5X2NlbGwuUg==) | `83.33% <100.00%> (+6.06%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

dramanica commented 1 year ago

Thanks @japilo for this. I don't think we should remove variables from a dataset. Could you please change it so that we recode the problematic variables as something like X_orig and Y_orig? Also, can you please add an appropriate unit test? Thanks!