Get or set the formal arguments of a function.
formals(fun = sys.function(sys.parent())) formals(fun, envir = environment(fun)) <- value
- a function object, or see ‘Details’.
- environment in which the function should be defined.
- a list (or pairlist) of R expressions.
For the first form,
fun can also be a character string naming the function to be manipulated, which is searched for from the parent frame. If it is not specified, the function calling
formals is used.
Only closures have formals, not primitive functions.
The replacement form sets the formals of a function to the list/pairlist on the right hand side, and (potentially) resets the environment of the function.
Documentation reproduced from R 2.15.3. License: GPL-2.