This generic transforms objects to functions. It is especially
useful with formulas to create lambdas on the fly.
Usage
as_function(.f, ...)
Arguments
.f
A function or formula.
If a function, it is used as is.
If a formula, e.g. ~ .x + 2, it is converted to a
function with two arguments, .x or . and
.y. This allows you to create very compact anonymous
functions with up to two inputs.
...
Additional arguments passed on to methods. Currently
unused in rlang.