Skip to content
Prev 30095 / 63421 Next

Attributes of top level environments clobbered (was Re: [R] possible bug in function 'var' in R 2.7.2?)

On Fri, Oct 3, 2008 at 3:23 AM, Martin Maechler
<maechler at stat.math.ethz.ch> wrote:
The bug discussed in the following year-old post suggested that
the problem of clobbering attributes of top level environment objects
would be fixed for 2.7 but its still in R version 2.7.2 (2008-08-25)"
and also still in  "R version 2.8.0 alpha (2008-10-01 r46589)"

   https://stat.ethz.ch/pipermail/r-devel/2007-October/047184.html

The Avoiding R Bugs section of this page:

   http://r-proto.googlecode.com

has more discussion as well as a list of some other R bugs.

This can be tested by creating a package with these two files only:

---DESCRIPTION---
Package: testlazy
Version: 1.0-0
Date: 2008-10-03
Title: Test lazy loading
Author: G Grothendieck
Maintainer: G Grothendieck <ggrothendieck at gmail.com>
Description: Test lazy loading with top level objects.
Depends: proto
LazyLoad: yes
License: GPL-2
---R/testlazy.R---
TopLevel <- proto()
---

And then testing it:

library(testlazy)
class(TopLevel)

If its class is "environment" only then the class attribute was stripped.