View source: R/length_test_linter.R
length_test_linter | R Documentation |
Usage like length(x == 0)
is a mistake. If you intended to check x
is empty,
use length(x) == 0
. Other mistakes are possible, but running length()
on the
outcome of a logical comparison is never the best choice.
length_test_linter()
best_practices, consistency, robustness
linters for a complete list of linters available in lintr.
# will produce lints
lint(
text = "length(x == 0)",
linters = length_test_linter()
)
# okay
lint(
text = "length(x) > 0",
linters = length_test_linter()
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.