vector_logic_linter {lintr} | R Documentation |
Usage of &
in conditional statements is error-prone and inefficient.
condition
in if (condition) expr
must always be length-1, in which
case &&
is to be preferred. Ditto for |
vs. ||
.
vector_logic_linter()
This linter covers inputs to if()
and while()
conditions and to
testthat::expect_true()
and testthat::expect_false()
.
best_practices, default, efficiency
linters for a complete list of linters available in lintr.
https://style.tidyverse.org/syntax.html#if-statements