TRUE
or a message about what is different between the two objects.
all.equal
.
all.equal.numeric(target, current, tolerance=, scale, ...)
sqrt(.Machine$double.eps)
.
The test used is on absolute difference if the target value is less than
or equal to the tolerance, and on relative difference otherwise,
measured in mean absolute values (not mean square).
scale=1
, you get the equivalent of absolute
scaling, although the output will read "Mean scaled difference:".
TRUE
.
Otherwise, returns a character vector giving all the discovered differences.
The
all.equal
methods are fussy tests that will generally report any differences
even those that might sometimes be considered irrelevant.
For example, using
dump
on a function,
then
restore
may result
in an equivalent function with comments parsed differently (and
which prints with different white space).
The only substantial leniency in the default methods is that
numerical equality is tested only up to
tolerance
.
Additional leniency can be built in by writing methods for special classes
of objects.
new.fit <- update(old.fit) all.equal(new.fit,old.fit) #Use scale parameter to obtain absolute difference set.seed(17) x <- matrix(1000*rnorm(12), ncol=3) y <- x y[4,3] <- 578.82 all.equal(x,y, tol=1e-5) all.equal(x,y, tol=1e-5, scale=1)