all_same: Check if all values in a vector are the same

View source: R/cardinality.R

all_sameR Documentation

Check if all values in a vector are the same

Description

Check if all values in a vector are the same

Usage

all_same(xx, na.rm = FALSE, fail_if_na = FALSE, ...)

Arguments

xx

A vector

na.rm

should NA values be omitted

fail_if_na

should function return FALSE when NA values are present

...

additional arguments passed to 'base::unique'

Value

logical value indicating whether all values in the vector were equal

Examples

all_same( c(rep(0, 10), NA) )
all_same( c(rep(0, 10), NA), na.rm=TRUE )
all_same( rep(NA, 10) )
all_same( rep(NA, 10), na.rm=TRUE )
all_same( rep(NA, 10), na.rm=FALSE, fail_if_na=TRUE )

stackcon/rngt documentation built on June 17, 2022, 5:29 p.m.