R: Convert Object to Function (original) (raw)
as.function {base} | R Documentation |
---|
Description
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](../../base/help/call.html)"
which will become the function body. The function will be defined in a specified environment, by default that of the caller.
Usage
as.function(x, ...)
## Default S3 method:
as.function(x, envir = parent.frame(), ...)
Arguments
x | object to convert, a list for the default method. |
---|---|
... | additional arguments to be passed to or from methods. |
envir | environment in which the function should be defined. |
Value
The desired function.
Author(s)
Peter Dalgaard
See Also
[function](../../base/help/function.html)
;[alist](../../base/help/alist.html)
which is handy for the construction of argument lists, etc.
Examples
as.function(alist(a = , b = 2, a+b))
as.function(alist(a = , b = 2, a+b))(3)
[Package _base_ version 4.6.0 Index]