ns-topenv                package:base                R Documentation

_T_o_p _L_e_v_e_l _E_n_v_i_r_o_n_m_e_n_t

_D_e_s_c_r_i_p_t_i_o_n:

     Finding the top level environment.

_U_s_a_g_e:

     topenv(envir = parent.frame(), matchThisEnv = getOption("topLevelEnvironment"))

_A_r_g_u_m_e_n_t_s:

   envir: environment.

matchThisEnv: return this environment, if it matches before any other
          criterion is satisfied.  The default, the option
          "topLevelEnvironment", is set by 'sys.source', which treats a
          specific environment as the top level environment. Supplying
          the argument as 'NULL' means it will never match.

_D_e_t_a_i_l_s:

     'topenv' returns the first top level environment found when
     searching 'envir' and its parent environments.  An environment is
     considered top level if it is the internal environment of a name
     space, a package environment in the search path, or '.GlobalEnv'.

_E_x_a_m_p_l_e_s:

     topenv(.GlobalEnv)
     topenv(new.env())

