any_duplicated_linter {lintr}R Documentation

Require usage of anyDuplicated() > 0 over any(duplicated(.))

Description

anyDuplicated() exists as a replacement for any(duplicated(.)) which is more efficient for simple objects, and in the worst case is the same efficiency. Therefore it should be used in all situations instead of the latter.

Usage

any_duplicated_linter()

Details

Also match usage like length(unique(x$col)) == nrow(x), which can be replaced by anyDuplicated(x$col) == 0L.

Tags

best_practices, efficiency

See Also

linters for a complete list of linters available in lintr.


[Package lintr version 3.0.1 Index]