

   outer {base}                                 R Documentation

   OOuutteerr PPrroodduucctt ooff AArrrraayyss

   DDeessccrriippttiioonn::

        The outer product of the arrays `X' and `Y' is the
        array `A' with dimension `c(dim(X), dim(Y))' where ele-
        ment `A[i, j, .., k, l, ..] = FUN(X[i, j, ..], Y[k,
        l,..], ..)'.

   UUssaaggee::

        outer(X, Y, FUN="*", ...)
        x %o% y

   AArrgguummeennttss::

          X: A vector or array.

          Y: A vector or array.

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

        ...: optional arguments to be passed to `FUN'.

   DDeettaaiillss::

        `FUN' must be a function (or the name of it) which
        expects at least two arguments and which operates ele-
        mentwise on arrays.

        Where they exist, the [dim]names of `X' and `Y' will be
        preserved.

        `%o%' is an `.Alias' for `outer' (where `FUN' cannot be
        changed from `"*"').

   AAuutthhoorr((ss))::

        Jonathan Rougier

   SSeeee AAllssoo::

        `matmult' for usual (inner) matrix vector multiplica-
        tion; `kronecker' which is based on `outer'.

   EExxaammpplleess::

        x <- 1:9; names(x) <- x
        # Multiplication & Power Tables
        x %o% x
        y <- 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]

