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

