AnnieHow / dod

dod package development
https://anniehow.github.io/dod/
3 stars 0 forks source link

should not use "if (something == TRUE)" #15

Closed dankelley closed 2 years ago

dankelley commented 2 years ago

I see e.g.

if (index == TRUE) {

in some spots of code. Since index is a logical, this is redundant. It should just read

if (index) {

Hint: such things can be found with the following in the terminal:

git grep -n "if.*TRUE"

which gives filename and line number.

PS. I think near the top of the function we should insist that it be a logical value, with

if (!is.logical(index))
    stop("'index' must be a logical value")
AnnieHow commented 2 years ago

@dankelley if this is fixed in commit 61019fbf2319814190d2123b0c0bd4a15ed5d1a2 and you're happy with the changes we could close this issue!

dankelley commented 2 years ago

Looks great, so closing now