Skip to contents

Test if all elements of a vector are identical

Usage

all_are_identical(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_identical(c(1,2,3))
#> [1] FALSE
all_are_identical(c(1,1,1))
#> [1] TRUE