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)

