[R] as.environment() does not work for "package:base"?

Philippe Grosjean phgrosjean at sciviews.org
Tue Mar 30 16:53:05 CEST 2004


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




More information about the R-help mailing list