[R] locked environment and inheritance

From: johan Faux <johanfaux_at_yahoo.com>
Date: Sun, 03 Jun 2007 18:27:40 -0700 (PDT)


Hi,

I have a S3 package with namespace called "myS3Pkg". Inside my package I would like to create a S4 class which extends (adds 2 slots) another S4 class from some other package. The class should be created in "myPkg" environment (and not global environment).

Using:

setClass("myS4class", representation("otherS4class", mydata = "numeric"), where = topenv())

I get:

Error in assign(classMetaName(Class), def, where) :

        cannot add bindings to a locked environment

I understand the fact that after "myPkg" is loaded, its namespace is sealed, but I was hoping to find a way around it.

I would appreciate any comment on this.

thank you.        


        [[alternative HTML version deleted]]



R-help_at_stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 04 Jun 2007 - 09:37:32 GMT

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 Mon 04 Jun 2007 - 22:31:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.