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
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
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.
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
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.
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