

outer {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 ele-
     ment `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 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_u_t_h_o_r_(_s_)_:

     Jonathan Rougier

_S_e_e _A_l_s_o_:

     `matmult' for usual (inner) matrix vector multiplica-
     tion; `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]

