ID EN
Data Types & Classes

as.function

R Base 3.6.2

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.

Syntax

R
as.function(x, &#8230;)<p></p><p># S3 method for default
as.function(x, envir = parent.frame(), &#8230;)</p>

Arguments

Parameter Description
x object to convert, a list for the default method.
&#8230; additional arguments, depending on object
envir environment in which the function should be defined

Return Value

The desired function.

Examples

Example
R
# NOT RUN {
as.function(alist(a = , b = 2, a+b))
as.function(alist(a = , b = 2, a+b))(3)
# }

See Also

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