

   environment {base}                           R Documentation

   EEnnvviirroonnmmeenntt AAcccceessss

   UUssaaggee::

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

   AArrgguummeennttss::

        fun: a `function' or `NULL', which is the default.

   VVaalluuee::

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

        `new.env' returns a new (empty) environment enclosed in
        the parent's environment.

        The assignment form sets the environment of the func-
        tion `fun' to the `value' given.  `is.environment(obj)'
        returns `TRUE' iff `obj' is an `environment'.

   SSeeee AAllssoo::

        The `envir' argument of `eval'.

   EExxaammpplleess::

        ##-- all three give the same:
        environment()
        environment(environment)
        .GlobalEnv

        ls(envir=environment(approxfun(1:2,1:2, method="const")))

        is.environment(.GlobalEnv)# T

