Environment Access

Usage

environment(fun = NULL)
environment(fun) <- value
is.environment(obj)
.GlobalEnv

Arguments

fun a function or NULL, which is the default.

Value

If fun is a function then environment(fun) returns the environment associated with that function. If fun is NULL then the global environment, .GlobalEnv, is returned. This variable is currently defined as globalenv().

The assignment form sets the environment of the function fun to the value given. is.environment(obj) returns TRUE iff obj is an 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)# T


[Package Contents]