View source: R/boolean_arithmetic_linter.R
boolean_arithmetic_linter | R Documentation |
length(which(x == y)) == 0
is the same as !any(x == y)
, but the latter
is more readable and more efficient.
boolean_arithmetic_linter()
best_practices, efficiency, readability
linters for a complete list of linters available in lintr.
# will produce lints
lint(
text = "length(which(x == y)) == 0L",
linters = boolean_arithmetic_linter()
)
lint(
text = "sum(grepl(pattern, x)) == 0",
linters = boolean_arithmetic_linter()
)
# okay
lint(
text = "!any(x == y)",
linters = boolean_arithmetic_linter()
)
lint(
text = "!any(grepl(pattern, x))",
linters = boolean_arithmetic_linter()
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.