| environment {base} | R Documentation |
Environment Access
Description
Get, set, test for and create environments.
Usage
environment(fun = NULL)
environment(fun) <- value
is.environment(obj)
.GlobalEnv
globalenv()
new.env()
Arguments
fun |
a |
value |
|
obj |
an arbitrary R object. |
Details
The global environment .GlobalEnv is the first item on the
search path, more often known as the user's workspace. It can also be
accessed by globalenv().
Value
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.
The assignment form sets the environment of the function or formula
fun to the value given.
is.environment(obj) returns TRUE iff obj is an
environment.
new.env returns a new (empty) environment enclosed in the
parent's environment.
See Also
The envir argument of eval.
Examples
##-- all three give the same:
environment()
environment(environment)
.GlobalEnv
ls(envir=environment(approxfun(1:2,1:2, method="const")))
is.environment(.GlobalEnv)# TRUE