all_same: all_same

View source: R/general_utils.R

all_sameR Documentation

all_same

Description

Check if all values in a vector are the same. It is robust also to NA values that can be handled with the na.rm parameter

Usage

all_same(x, na.rm = FALSE)

Arguments

x

a vector

na.rm

logical indicating whether NA values should be removed or not.

Value

logical vector

Examples

all_same(c(1,1,1))  # TRUE
all_same(c(1,2,3))  # FALSE
all_same(c(1,1,NA)) # FALSE
all_same(c(1,1,NA), na.rm = TRUE) # TRUE

filippogambarota/filor documentation built on July 3, 2025, 8:39 p.m.