Does the input have duplicates?

hasDuplicates(x, .xname = getNameInParent(x))

hasNoDuplicates(x, .xname = getNameInParent(x))

Arguments

x

Object.

.xname

Not intended to be used directly.

Value

TRUE on success; FALSE on failure, with cause attribute set.

See also

Examples

## TRUE ==== hasDuplicates(c("a", "a"))
#> [1] TRUE
hasNoDuplicates(c("a", "b"))
#> [1] TRUE
## FALSE ==== hasDuplicates(c("a", "b"))
#> [1] FALSE #> Cause of failure: #> c("a", "b") has no duplicates.
hasNoDuplicates(c("a", "a", "b", "b"))
#> [1] FALSE #> Cause of failure: #> c("a", "a", "b", "b") has duplicates at positions 2, 4.