outer2: Outer product of multiple arrays

Description Usage Arguments Value Examples

View source: R/outer2.R

Description

This function works similarly as base::outer() except that it allows the multiplication of more arguments than just two.

Usage

1
outer2(f, ...)

Arguments

f

The function to be used on the outer products

...

Vectors, matrices or arrays whose values will be used as arguments to the function f. The elements of the first argument will be used as the first argument to f, elements of the second argument will be used as the second argument to f etc.

Value

An array that is an outer product of the input arguments.

Examples

1
2
3
4
5
6
outer2(prod, 1:4)           # returns 1:4
outer2(prod, 1:4, 1:3)      # the same as 1:4 %o% 1:3
outer2(prod, 1:4, 1:3, 1:2) # the same as (1:4 %o% 1:3) %o% 1:2

# to see how f is called with arguments:
outer2(paste, 1:4, 1:3, 1:2)

beerda/hexmatrix documentation built on May 2, 2021, 4:15 a.m.