all_elements_the_same: Check whether all elements of a list are identical

View source: R/is_are.R

all_elements_the_sameR Documentation

Check whether all elements of a list are identical

Description

Check whether all elements of a list are identical.

Usage

all_elements_the_same(list)

Arguments

list

(list) The list to check.

Value

TRUE if all elements are identical, FALSE if not.

Examples

#test lists
l_testlist_ok = list(1:3, 1:3, 1:3, 1:3, 1:3, 1:3)
l_testlist_bad = list(1:3, 1:3, 1:4, 1:3, 1:3, 1:3)
all_elements_the_same(l_testlist_ok) #TRUE
all_elements_the_same(l_testlist_bad) #FALSE
all_elements_the_same(list()) #TRUE if list is empty

Deleetdk/kirkegaard documentation built on April 22, 2024, 5:22 p.m.