Re: [Rd] Creating an environment with attributes in a package

2010-07-16 Thread John Chambers
Note that S4 classes extend "environment" and other reference types, by using a hidden slot. You can then add other slots. So, with some extra work: > setClass("myEnv", contains = "environment", + representation(myName = "character")) [1] "myEnv" > Foo <- new("myEnv", myName = "Foo") > Foo An

Re: [Rd] Creating an environment with attributes in a package

2010-07-16 Thread Jon Clayden
On 16 July 2010 13:32, Hadley Wickham wrote: > On Fri, Jul 16, 2010 at 2:08 PM, Jon Clayden wrote: >> Dear all, >> >> I am trying to create an environment object with additional attributes, viz. >> >> Foo <- structure(new.env(), name="Foo") >> >> Doing this in a standard session works fine: I get

Re: [Rd] Creating an environment with attributes in a package

2010-07-16 Thread Hadley Wickham
On Fri, Jul 16, 2010 at 2:08 PM, Jon Clayden wrote: > Dear all, > > I am trying to create an environment object with additional attributes, viz. > > Foo <- structure(new.env(), name="Foo") > > Doing this in a standard session works fine: I get the environment > with attr(,"name") set as expected.

Re: [Rd] Creating an environment with attributes in a package

2010-07-16 Thread Gabor Grothendieck
On Fri, Jul 16, 2010 at 8:15 AM, Gabor Grothendieck wrote: > On Fri, Jul 16, 2010 at 8:08 AM, Jon Clayden wrote: >> Dear all, >> >> I am trying to create an environment object with additional attributes, viz. >> >> Foo <- structure(new.env(), name="Foo") >> >> Doing this in a standard session wor

Re: [Rd] Creating an environment with attributes in a package

2010-07-16 Thread Gabor Grothendieck
On Fri, Jul 16, 2010 at 8:08 AM, Jon Clayden wrote: > Dear all, > > I am trying to create an environment object with additional attributes, viz. > > Foo <- structure(new.env(), name="Foo") > > Doing this in a standard session works fine: I get the environment > with attr(,"name") set as expected.

[Rd] Creating an environment with attributes in a package

2010-07-16 Thread Jon Clayden
Dear all, I am trying to create an environment object with additional attributes, viz. Foo <- structure(new.env(), name="Foo") Doing this in a standard session works fine: I get the environment with attr(,"name") set as expected. But if the same code appears inside a package source file, I get j