Skip to content

all.equal() improvements (PR#8191)

1 message · Andrew Piskorski

#
--k1lZvvs/B4yU6o8G
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

The attached patch against R 2.2.0 makes the following improvements to
the all.equal() function:

1. Check names!  Stock R all.equal() (unlike S-Plus) ignores names
   completely on some objects.  I consider this wrong - if the names
   are different, the object is NOT "the same".

2. When a difference is detected, return better output to help the
   user understand just WHAT is different.

Further details are included in the code comments, but in particular,
all.equal.list() is much enhanced.  By default it still checks list
values by postion rather than name, as that behavior is more strict
and thus more correct.

But when using the by.name="auto" and by.pos=TRUE options (which are
the defaults), in addition to by-positing differences,
all.equal.list() now also reports by-name differences in those places
(and only those places) where doing so should be helpful to the user.

Also, optionally, using by.name=TRUE and by.pos=FALSE will give
behavior like S-Plus.

The attached patch is also available here:

  http://www.piskorski.com/R/patches/all-equal-patch-20051009.txt

If you want to see the entire file rather than a patch against R
2.2.0, that is also available here:

  http://www.piskorski.com/R/patches/all.equal.R