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, ...)

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

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

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

# S3 method for 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).