Given a vector, are all the values in it the same?

allSame(x)

Arguments

x

a vector

Value

TRUE, if all the values are the same (or the vector is empty)

Examples

allSame(c(TRUE, TRUE, TRUE))
#> Loading required package: utils
#> [1] TRUE
allSame(c(TRUE, TRUE, FALSE))
#> [1] FALSE
allSame(c(FALSE, FALSE))
#> [1] TRUE
allSame(NULL)
#> [1] TRUE