all_the_same: Are all elements of a vector or list the same?

View source: R/is_are.R

all_the_sameR Documentation

Are all elements of a vector or list the same?

Description

Tests whether all elements of a simple vector are the same.

Usage

all_the_same(x)

Arguments

x

A vector or list to test.

Examples

all_the_same(rep(1, 100))
all_the_same(rnorm(100))
all_the_same(letters[rep(1, 10)])
all_the_same(letters[sample(1:10, size = 10)])
all_the_same(list(1:10, 1:10, 1:10))
all_the_same(list(1:10, 1:10, 1:11))
#careful with NAs
all_the_same(c(1, 1, NA))

Deleetdk/kirkegaard documentation built on Feb. 28, 2025, 5:04 p.m.