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

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

Closed jonocarroll closed 7 years ago

jonocarroll commented 7 years ago

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.

droglenc commented 7 years ago

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

droglenc commented 7 years ago

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.