flip: Flip 1st and 2nd argument of a function

Description Usage Arguments Value Examples

Description

Flip 1st and 2nd argument of a function

Usage

1
flip(f)

Arguments

f

Function whose 1st and 2nd argument should be flipped

Value

Same function with its 1st and 2nd argument flipped.

Examples

1
2
3
4
5
6
7
f <- function(x, y, z) {
    x + 2*y + 3*z
}
g <- flip(f)
f(1, 2, 3) == 14
g(1, 2, 3) == 13
g(z = 3, 1, 2) == 13

cbaumbach/miscFun documentation built on May 13, 2019, 1:48 p.m.