environment               package:base               R Documentation

_E_n_v_i_r_o_n_m_e_n_t _A_c_c_e_s_s

_D_e_s_c_r_i_p_t_i_o_n:

     Get, set, test for and create environments.

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

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

   value: 

     obj: an arbitrary R object.

_V_a_l_u_e:

     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 global environment, `.GlobalEnv', is
     returned.  This variable is currently defined as `globalenv()'.

     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.

_S_e_e _A_l_s_o:

     The `envir' argument of `eval'.

_E_x_a_m_p_l_e_s:

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

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

     is.environment(.GlobalEnv)# TRUE

