all_equal2: Test if two or more objects are (nearly) equal

View source: R/zxx.R

all_equal2R Documentation

Test if two or more objects are (nearly) equal

Description

A generalization of all.equal that allows more than two objects to be tested for near-equality.

Usage

all_equal2(
  ...,
  tolerance = .Machine$double.eps^0.5,
  scale = NULL,
  check.attributes = TRUE,
  use.names = TRUE,
  all.names = TRUE,
  check.names = TRUE
)

Arguments

...

any R objects

tolerance

numeric >= 0; differences smaller than tolerance are not reported (default value is close to 1.5e-8)

scale

numeric scalar > 0 (or NULL), see details in all.equal

check.attributes

logical indicating if the attributes should be compared

use.names

logical indicating if list comparison should report differing components by name (if matching) instead of integer index

all.names

logical passed to ls indicating if "hidden" objects should also be considered in the environments

check.names

logical indicating if the names(.) should be compared

Value

If all ... are nearly equal, TRUE otherwise returns a list with the objects that failed.

See Also

all.equal; identical2; identical

Examples

all_equal2(pi, 355/113, 22/7)

all_equal2(pi, 355/113, 22/7, tolerance = 0.01)

all_equal2(cars[1], cars[, 1, drop = FALSE], cars[, -2, drop = TRUE])


raredd/rawr documentation built on May 19, 2024, 1:02 p.m.