as.environment             package:base             R Documentation

_C_o_e_r_c_e _t_o _a_n _E_n_v_i_r_o_n_m_e_n_t _O_b_j_e_c_t

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

     Converts a number or a character string to the corresponding
     environment on the search path.

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

     as.environment(object)

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

  object: the object to convert.  If it is already an environment, just
          return it.  If it is a number, return the environment
          corresponding to that position on the search list.  If it is
          a character string, match the string to the names on the
          search list.

_V_a_l_u_e:

     The corresponding environment object.

_A_u_t_h_o_r(_s):

     John Chambers

_S_e_e _A_l_s_o:

     'environment' for creation and manipulation, 'search'.

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

     as.environment(1) ## the global environment
     identical(globalenv(), as.environment(1)) ## is TRUE
     try(as.environment("package:stats"))      ## stats need not be loaded

