Something I see often while reading code: Testing (in)equality of logical vectors with Boolean values is redundant. To check if you are using this antipattern somewhere in your project or package, you can use {lintr} 📦: lintr.r-lib.org/dev/referenc… #rstats
1
4
32
Replying to @patilindrajeets
Correct in principle and for 'standard' programming languages with two boolean values. But because #rstats has three (!!) you are actually better of using either one of isTRUE() isFALSE() which are also instructive to look at in source (one liners, just hit RETURN)

Oct 30, 2022 · 7:16 PM UTC

2
1
16
I think it's good practice to only use isTRUE/isFALSE if you expect a non TRUE/FALSE value. In complex scenarios, you are likely to suppress important warnings/errors that can make you aware of bugs in your code.
1
2
True. E.g. empty vectors will be considered `FALSE`, but maybe they are indicative of some problem and will be missed out on because there was no warning/error.