| 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 |
Examples
outer(1:5, 1:5, "+")