fishR-Core-Team / FSA

FSA (Fisheries Stock Assessment) package provides R functions to conduct typical introductory fisheries analyses.

Home Page:https://fishr-core-team.github.io/FSA/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

r-devel compatibility re: if(x) with length(x) > 1

jonocarroll opened this issue · comments

Browsing through some checks performed for the upcoming change to if() (see https://twitter.com/groundwalkergmb/status/842434055425556480) I notice that there are some internal improvements that could be made, e.g. the best practice for code like

if(class(x) == "name") { }

is

if (inherits(x, "name")) { }

since x may inherit from multiple classes. An is.XXX <- function(x) inherits(x, "XXX") helper may be useful for these cases.

There are potentially a few places in FSA where if() is used with length > 1 vectors (hence the suppressWarnings() I suppose). I have interest in this package and would like to contribute - would you mind if I have a go and PR something with tests against r-devel and this new if() scenario?

Once I'm familiar, I may be able to contribute to the fisheries code also.

That sounds great. Let me know how I can help. Thanks.

I believe that I fixed most of these and fixed them. I still need to follow-up with the suppressWarnings(). Functions that were changed are in the latest news files.