View source: R/make-fn-aware.R
make_fn_aware | R Documentation |
make_fn_aware()
is a functional operator that enhances a function by
enabling it to interpret abbreviated functional arguments.
make_fn_aware(f, ...)
f |
Function, or symbol or name of a function. |
... |
Name(s) of functional argument(s) of |
A function with the same call signature as f
, but whose function
arguments, as designated by ...
, may be specified using an abbreviated
function expression of the form .(...)
, cf. as_fn()
. If ...
is empty
or NULL
, then f
is simply returned.
as_fn()
reduce <- make_fn_aware(Reduce, "f") ## reduce() behaves just like Reduce() Reduce(function(u, v) u + 1 / v, c(3, 7, 15, 1, 292), right = TRUE) reduce(function(u, v) u + 1 / v, c(3, 7, 15, 1, 292), right = TRUE) ## reduce() can also interpret abbreviated function expressions reduce(.(u, v ~ u + 1 / v), c(3, 7, 15, 1, 292), right = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.