Does the input contain a duplicate value?
Source:R/check-vector-isDuplicate.R
check-vector-isDuplicate.Rd
Does the input contain a duplicate value?
Details
This check is designed to serve as a complement to the base duplicated
function, which only returns TRUE
after the first observed duplicate value.
Our check here returns TRUE
for all values that are duplicated.
Examples
## TRUE ====
x <- c("a", "a", "b", "b", "c", "d")
isDuplicate(x)
#> [1] TRUE TRUE TRUE TRUE FALSE FALSE
duplicated(x)
#> [1] FALSE TRUE FALSE TRUE FALSE FALSE
## FALSE ====
isDuplicate(c("a", "b", "c"))
#> [1] FALSE FALSE FALSE