getTemp                package:svMisc                R Documentation

_G_e_t _a _t_e_m_p_o_r_a_r_y _v_a_r_i_a_b_l_e _f_r_o_m _t_h_e _T_e_m_p_E_n_v _e_n_v_i_r_o_n_m_e_n_t

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

     The function gets a variable, or an item in a list variable from
     TempEnv, an environment dedicated to temporary variables.

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

         getTemp(x, default = NULL, mode = "any", item = NULL)

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

       x: The name of the variable 

 default: The default value to return, in case the variable or the item
          does not exist 

    mode: The mode of the variable or the item (if the variable exists,
          but is not of correct mode, the default value is returned).
          Use 'mode = "any"' (default value) to retrieve the variable
          or item whatever its mode. 

    item: if 'NULL' (default), the whole variable content is retrieve,
          otherwise, the variable is considered as a list, and the
          corresponding item from that list is returned. In this case,
          'default' and 'mode' arguments correspond to the item, not to
          the whole variable.

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

     The content of the variable, of the item, or the default value if
     the variable or item is not found in TempEnv, or of the wrong
     mode.

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

     Philippe Grosjean <phgrosjean@sciviews.org>

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

     'TempEnv', 'assignTemp', 'changeTemp', 'rmTemp', 'existsTemp',
     'addTemp'

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

     assignTemp("test", 1:10)
     # Retrieve this variable
     getTemp("test")
     # Retrieve a non existing variable (returns default value)
     getTemp("nonexistant", default = "default value")
     # Set and retrieve items from a list
     changeTemp("test2", "item1", 1:5)
     getTemp("test2", item = "item1")
     # Compare to:
     getTemp("test2")
     # Remove temporary variables
     rmTemp(c("test", "test2"))

