According to 
:https://stat.ethz.ch/R-manual/R-devel/library/base/html/environment.html

"If |fun| is a function or a formula then |environment(fun)| returns the 
environment associated with that function or formula. If |fun| is |NULL| 
then the current evaluation environment is returned."

 > environment()
<environment: R_GlobalEnv>
 > environment(environment)
<environment: namespace:base>

This makes sense, however I have two questions on things that don't seem 
to make sense:

1.

 > .Internal(environment(NULL))
<environment: base>

Since we are calling from R_GlobalEnv, how can the calling environment 
be base?

2.

In eval.R in library/base/R:

.GlobalEnv <- environment()
parent.frame <- function(n = 1) .Internal(parent.frame(n))
etc.

Since the functions being defined are in base, how can the calling 
environment be R_GlobalEnv. Or does this just set .GlobalEnv temporarily 
to base?

Thanks
Mick Jordan


        [[alternative HTML version deleted]]

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to