[R] as.environment() does not work for "package:base"?
Philippe Grosjean
phgrosjean at sciviews.org
Wed Mar 31 14:08:57 CEST 2004
OK. Thank you. I have not seen that particularity in the documentation... is
it written somewhere?
However, I found:
> .BaseNamespaceEnv
<environment: namespace:base>
which is, according to the documentation, still experimental. Should I
better use envir = NULL or .BaseNamespaceEnv to get a full control on
objects in the base environment (this is for an object browser, so, I need
full control on EVERY object in any environment), given that I will be
careful of course with experimental stuff?
Best,
Philippe Grosjean
-----Original Message-----
From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk]
Sent: Tuesday, 30 March, 2004 22:28
To: Philippe Grosjean
Cc: r-help
Subject: Re: [R] as.environment() does not work for "package:base"?
NULL is the correct answer: as an environment base is denoted by NULL.
Did you think to try
ls(envir=NULL)
? If not, do so now.
On Tue, 30 Mar 2004, Philippe Grosjean wrote:
> Hello,
>
> I want to retrieve one environment from the search path. I have:
>
> > search()
> [1] ".GlobalEnv" "package:R2HTML" "package:tcltk"
"package:methods"
> "package:ctest"
> [6] "package:mva" "package:modreg" "package:nls" "package:ts"
> "Autoloads"
> [11] "package:base"
> > as.environment(1)
> <environment: R_GlobalEnv>
> > as.environment(2)
> <environment: package:R2HTML>
> attr(,"name")
> [1] "package:R2HTML"
> attr(,"path")
> [1] "C:/PROGRA~1/R/rw1081/library/R2HTML"
> > as.environment(10)
> <environment: 01749504>
> attr(,"name")
> [1] "Autoloads"
> > as.environment(11)
> NULL
> > as.environment("package:base")
> NULL
>
> So, everything works fine, except for "package:base", the 11th entry. Is
it
> by purpose that as.environment() returns NULL? Is it because
"package:base"
> is "sealed"? Then, how do I get the environment corresponding to
> "package:base"?
>
> Thanks,
>
> Philippe Grosjean
>
> .......................................................<°}))><....
> ) ) ) ) )
> ( ( ( ( ( Prof. Philippe Grosjean
> \ ___ )
> \/ECO\ ( Numerical Ecology of Aquatic Systems
> /\___/ ) Mons-Hainaut University, Pentagone
> / ___ /( 8, Av. du Champ de Mars, 7000 Mons, Belgium
> /NUM\/ )
> \___/\ ( phone: + 32.65.37.34.97, fax: + 32.65.37.33.12
> \ ) email: Philippe.Grosjean at umh.ac.be
> ) ) ) ) ) SciViews project coordinator (http://www.sciviews.org)
> ( ( ( ( (
> ...................................................................
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
>
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list