could someone please explain to me what these various environment functions do specifically? ie which one returns what frame? i am thoroughly confused after reading the documentation (http://stat.ethz.ch/R-manual/R-patched/library/base/html/sys.parent.html)
Let's put some structure on the question:
x = 1; y=2; z=3;
f = function() { ls(); ls(envir=sys.frame());}
#this first prints the contents of this function and then of the global environment
I am trying to understand how one can access environments of calling functions and to know which environment you are in. For example g
could have called f
:
g = function() { somevar=1; f() }
If I wanted to get the contents of g
, how would i do that? What is the difference between a frame and an environment?