This help topic is for R version 0.60. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/outer.html
outer {base}R Documentation

Outer Product of Vectors

Description

The outer product of the vectors x and y is the matrix A with elements A[i, j] = FUN(x[i], y[j], ...). FUN must be a function which expects at least two arguments and which operates elementwise on arrays.

This needs to be extended to taking arrays of arbitrary dimension for x and y and returns an array of dimension c(dim(x), dim(y)).

Usage

outer(x, y, FUN = "*", ...)

Arguments

x

a vector.

y

a vector.

FUN

a function to use on the outer products, it may be a quoted string.

...

optional arguments to be passed to fun.

Examples

outer(1:5, 1:5, "+")

[Package base version 0.60 ]