outer                  package:base                  R Documentation

_O_u_t_e_r _P_r_o_d_u_c_t _o_f _A_r_r_a_y_s

_D_e_s_c_r_i_p_t_i_o_n:

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

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_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_e_t_a_i_l_s:

     `FUN' must be a function (or the name of it) which expects at
     least two arguments and which operates elementwise 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_u_t_h_o_r(_s):

     Jonathan Rougier

_S_e_e _A_l_s_o:

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

_E_x_a_m_p_l_e_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]

