Skip to content
Prev 343414 / 398506 Next

What the difference between .Golbalenv and package:base?

First, sorry for my pool english expression which make you misunderstanding of my original purpose.

Sometimes, suppose ?a object in both stats and base, then i type the object name, then after R search the search() list, R will use the object in stats, is it right?( I just suppose, stats can be any package which libraried into R.)
Then i know that, .GlobalEnv or globalenv() is the global environment object, baseenv() returns the base environment object.
I also know that, i can convert the environment name into the real environment object by using stats<-as.environment("package:stats"), ?And the stats environment's name can be obtained using environmentName(stats), but it returns "". ? (why?)
Then i use ?environmentName(.GlobalEnv) then i get "R_GlobalEnv", then i use?as.environment("R_GlobalEnv"), it does't work.(why?)


In one word, as.environment(x), x is somthing not the environment's name.?


But, when i add a environment into the search() list, after i attr(newenvir,"name")<-"new_name"
I can use the??as.environment("new_name") to obtain the added environment. (why?)


Hope you understand my meaning :)












--

PO SU
mail: desolator88 at 163.com 
Majored in Statistics from SJTU
At 2014-08-26 02:51:54, "MacQueen, Don" <macqueen1 at llnl.gov> wrote: