Rev 25539 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{outer}\alias{outer}\alias{\%o\%}\title{Outer Product of Arrays}\description{The outer product of the arrays \code{X} and \code{Y} is the array\code{A} with dimension \code{c(dim(X), dim(Y))} where element\code{A[c(arrayindex.x, arrayindex.y)]= FUN(X[arrayindex.x], Y[arrayindex.y], \dots)}.}\usage{outer(X, Y, FUN="*", \dots)X \%o\% Y}\arguments{\item{X}{A vector or array.}\item{Y}{A vector or array.}\item{FUN}{a function to use on the outer products, it may be a quotedstring.}\item{\dots}{optional arguments to be passed to \code{FUN}.}}\details{\code{FUN} must be a function (or the name of it) which expects atleast two arguments and which operates elementwise on arrays.Where they exist, the [dim]names of \code{X} and \code{Y} will bepreserved.\code{\%o\%} is an alias for \code{outer} (where \code{FUN}cannot be changed from \code{"*"}).}\author{Jonathan Rougier}\references{Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)\emph{The New S Language}.Wadsworth \& Brooks/Cole.}\seealso{\code{\link{\%*\%}} for usual (\emph{inner}) matrix vectormultiplication;\code{\link{kronecker}} which is based on \code{outer}.}\examples{x <- 1:9; names(x) <- x# Multiplication & Power Tablesx \%o\% xy <- 2:8; names(y) <- paste(y,":",sep="")outer(y, x, "^")outer(month.abb, 1999:2003, FUN = "paste")## three way multiplication table:x \%o\% x \%o\% y[1:3]}\keyword{array}