lengths_linter | R Documentation |
lengths()
where possiblelengths()
is a function that was added to base R in version 3.2.0 to
get the length of each element of a list. It is equivalent to
sapply(x, length)
, but faster and more readable.
lengths_linter()
best_practices, efficiency, readability
linters for a complete list of linters available in lintr.
# will produce lints
lint(
text = "sapply(x, length)",
linters = lengths_linter()
)
lint(
text = "vapply(x, length, integer(1L))",
linters = lengths_linter()
)
lint(
text = "purrr::map_int(x, length)",
linters = lengths_linter()
)
# okay
lint(
text = "lengths(x)",
linters = lengths_linter()
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.