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())