View source: R/outer_negation_linter.R
outer_negation_linter | R Documentation |
!any(x)
over all(!x)
, !all(x)
over any(!x)
any(!x)
is logically equivalent to !all(x)
; ditto for the equivalence of
all(!x)
and !any(x)
. Negating after aggregation only requires inverting
one logical value, and is typically more readable.
outer_negation_linter()
best_practices, efficiency, readability
linters for a complete list of linters available in lintr.
# will produce lints
lint(
text = "all(!x)",
linters = outer_negation_linter()
)
lint(
text = "any(!x)",
linters = outer_negation_linter()
)
# okay
lint(
text = "!any(x)",
linters = outer_negation_linter()
)
lint(
text = "!all(x)",
linters = outer_negation_linter()
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.