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
65 stars 20 forks source link

internal function to check `conf.level=` argument #66

Closed droglenc closed 3 years ago

droglenc commented 3 years ago

Several functions use conf.level= and most of them have the following "checking" code ...

if (conf.level<=0 | conf.level>=1) STOP("'conf.level' must be between 0 and 1")

I suggest creating an internal function (to be in FSAInternals.R) called iCheckConfLevel() that will first check to make sure conf.level is numeric and then perform this check. It may look like this ...

iCheckConfLevel <- function(conf.level) {
  if (!is.numeric(conf.level)) STOP("'conf.level' must be numeric.")
  if (conf.level<=0 | conf.level>=1) STOP("'conf.level' must be between 0 and 1")

Functions that currently perform this check that could be replaced with iCheckConfLevel() are ...

Functions that may use conf.level= but don't appear to check anything are ...

jcdoll79 commented 3 years ago

working on issue in "conf_level" branch.

jcdoll79 commented 3 years ago

@droglenc I believe I have addressed the conf.check at all necessary locations and added new tests for each function that was affected. I do not have a comparisonsDVR.R file and it looks like the compSlopes() and compIntercepts() functions were removed based on FSA-defunct.R. Would they be in another location? If not, I'll do one last check and submit a pull request.

droglenc commented 3 years ago

@jcdoll79 When I made those functions defunct, I took them out of FSA (and put them in FSAmisc, for safe keeping). You don't need to do anything more with them. I should have commented about this on this issue earlier. Sorry. Thanks.