>>>>> "hw" == hadley wickham <h.wickham_at_gmail.com> >>>>> on Thu, 1 May 2008 20:53:10 -0500 writes:
>> a <- list()
>> b <- structure(list(), class=c("list", "a"))
>> all.equal(a, b)
hw> [1] "Attributes: < Modes: list, NULL >"
hw> [2] "Attributes: < names for target but not for current >"
hw> [3] "Attributes: < Length mismatch: comparison on first 0 components >"
hw> which does not reveal the simple difference between a and b. I had
hw> also expected that all.equal would (in some sense) be symmetric with
hw> respect to its arguments, but I can see that this would be very hard
hw> to guarantee in general.
hw> Hadley
You can use 'check.attributes' :
> str(all.equal)
function (target, current, ...)
> str(all.equal.list)
function (target, current, check.attributes = TRUE, ...)
> a <- list(); b <- structure(a, class=c("list", "a")); all.equal(a, b)
[1] "Attributes: < target is NULL, current is list >"
> all.equal(a,b, check.attributes=FALSE)
[1] TRUE
> all.equal(b,a, check.attributes=FALSE)
[1] TRUE
>
Martin Maechler, ETH Zurich
Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.
Archive generated by hypermail 2.2.0, at Thu 08 May 2008 - 09:31:27 GMT.
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.