[Rd] all.equal on external pointers and environments

From: Martin Morgan <mtmorgan_at_fhcrc.org>
Date: Wed, 05 Sep 2012 13:50:19 -0700


For an external pointer

> xp

<pointer: (nil)>

one might expect all.equal to behave as for environments

> e = new.env()
> all.equal(e, e)

[1] TRUE but it does not

> all.equal(xp, xp)

Error in unclass(target) : cannot unclass an external pointer

A solution is to dispatch to all.equal.language (?) in

src/library/base/R/all.equal.R:26

but this requires an is.expternalptr primitive.

In some respects, one might expect all.equal for environments to be more thorough

   e = new.env(); e[["a"]] = 1

   all.equal(e, new.env())          ## expect FALSE, as in next line
   all.equal(as.list(e), as.list(new.env()))
   all.equal(new.env(), new.env())  ## TRUE; ok?

Martin

-- 
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed 05 Sep 2012 - 20:54:42 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

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 06 Sep 2012 - 02:00:41 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.

list of date sections of archive