Skip to contents

Test if all elements of a vector are unique

Usage

all_are_distinct(x, empty_value = FALSE)

Arguments

x

any object that can be handled by unique() (usually a vector or list)

empty_value

Value to return if function is called on a vector of length 0 (e.g. NULL, numeric(), ...)

Value

TRUE or FALSE

Examples

all_are_distinct(c(1,2,3))
#> [1] TRUE
all_are_distinct(c(1,1,1))
#> [1] FALSE