

formals {base}                               R Documentation

_A_c_c_e_s_s _t_o _a_n_d _M_a_n_i_p_u_l_a_t_i_o_n _o_f _t_h_e _F_o_r_m_a_l _A_r_g_u_m_e_n_t_s

_U_s_a_g_e_:

     formals(fun=sys.function(sys.parent()))
     formals(obj) <- list

_V_a_l_u_e_:

     If `fun' is a function then the formal argument list to
     that function is returned.  If `fun' is a character
     string then the function with that name is found and
     used.  If `fun' is not specified then the function
     calling `formals' is used.

     The assignment form sets the formals of a function to
     the list on the right hand side.

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

     `args' for a ``human-readable'' version, `alist',
     `body', `function'.

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

     length(formals(lm))      # the number of formal arguments
     names(formals(boxplot))  # formal arguments names

     f <- function(x)a+b
     formals(f) <- alist(a=,b=3) # function(a,b=3)a+b
     f(2) # result = 5

