Skip to contents

A fast, unsafe alternative to base::outer().

Usage

fouter(x, y, fun)

Arguments

x

(atomic vector)
The first argument for function fun.

y

(atomic vector)
The second argument for function fun.

fun

(function)
The function to apply to x and y.

Value

A matrix with length(x) rows and length(y) columns. Values are returned by fun() after pairwise expansion of x and y.

See also

Examples

#----------------------------------------------------------------------------
# fouter() example
#----------------------------------------------------------------------------
library(bkbase)

x <- c(1, 2)
y <- c(3, 4)

fouter(x, y, `+`)
#>      [,1] [,2]
#> [1,]    4    5
#> [2,]    5    6