fishR-Core-Team / FSA

FSA (Fisheries Stock Assessment) package provides R functions to conduct typical introductory fisheries analyses.
https://fishr-core-team.github.io/FSA/
GNU General Public License v2.0
66 stars 22 forks source link

Warn about non-integers in `removal()` #60

Closed droglenc closed 3 years ago

droglenc commented 4 years ago

The removal() function is primarily used with catch of individuals data. Thus, the data should generally be whole numbers that are positive. Consider adding a check for whole numbers and throwing a warning, not an error (as some have used removal() to estimate biomass and thus have used non-whole numbers). Do not use is.integer(). Look at is.whole() in several other packages.

jcdoll79 commented 3 years ago

is.wholenumber() in bazar and is.whole() in bgr check for numeric when checking for whole number. Suggest doing the same. Submitting the next two lines to FSA: ct3=c("one","two","three") removal(ct3) returns "Error in sum(ct3) : invalid 'type' (character) of arguments. The error is being thrown on line 254 of removal.R during internal calculations of intermediate values Suggest adding a check for numeric when checking for integer. Return error when non-numeric value found and warning when numeric but not whole number.

droglenc commented 3 years ago

Your ct3 example brings up several issues with the "checks" at the beginning of removal(). Some thoughts about how to proceed ...

Relatedly ...