%on% {funprog} | R Documentation |
Execute the binary function f on the results of applying unary function g to two arguments x and y.
f %on% g
f |
a binary function. |
g |
a unary function. |
Formally, %on%
is defined this way :
function(f, g) function(x, y) f(g(x), g(y))
.
f can be a function taking two arguments but also a variadic function (i.e.
whose first argument is ...
), which will be fed with exactly two
arguments.
A typical usage of this function is in combination with function like
group_if
.
A binary function. This function transforms 2 inputs (with g) and combines the outputs (with f).
h <- max %on% abs
h(-2, 1)