Skip to contents

Test if an object is invariant (i.e. all values are equal, within a given tolerance for numeric vectors).

Usage

is_invariant(x, ...)

# Default S3 method
is_invariant(x, na.rm = FALSE, ...)

# S3 method for class 'numeric'
is_invariant(x, na.rm = FALSE, tol = sqrt(.Machine$double.eps), ...)

# S3 method for class 'list'
is_invariant(x, incl_nm = TRUE, ...)

# S3 method for class 'data.frame'
is_invariant(x, ...)

Arguments

x

object to be tested

...

unused; for extensibility

na.rm

logical indicating whether to exclude NA values

tol

double, tolerance to use (for numeric vectors)

incl_nm

Whether top-level names should be included in determining if a list is invariant (default: TRUE).