as.function               package:base               R Documentation

_C_o_n_v_e_r_t _O_b_j_e_c_t _t_o _F_u_n_c_t_i_o_n

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

     'as.function' is a generic function which is used to convert
     objects to functions.

     'as.function.default' works on a list 'x', which should contain
     the concatenation of a formal argument list and an expression or
     an object of mode '"call"' which will become the function body.
     The function will be defined in a specified environment, by
     default that of the caller.

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

     as.function(x, ...)

     ## Default S3 method:
     as.function(x, envir = parent.frame(), ...)

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

       x: object to convert, a list for the default method.

     ...: additional arguments, depending on object

   envir: environment in which the function should be defined

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

     The desired function.

_N_o_t_e:

     For ancient historical reasons, 'envir = NULL' uses the global
     environment rather than the base environment.   Please use 'envir
     = globalenv()' instead if this is what you want, as the special
     handling of 'NULL' may change in a future release.

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

     Peter Dalgaard

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

     'function'; 'alist' which is handy for the construction of
     argument lists, etc.

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

     as.function(alist(a=,b=2,a+b))
     as.function(alist(a=,b=2,a+b))(3)

