This help topic is for R version 0.64.2. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/matmult.html
%*% {base}R Documentation

Matrix Multiplication

Description

Multiplies two matrices, if they are conformable. If one argument is a vector, it will be coerced to a either a row or column matrix to make the two arguments conformable. If both are vectors it will return the inner product.

Usage

a%*%b

Value

The matrix product

See Also

matrix, Arithmetic, diag.

Examples

x <- 1:4
x%*%x # scalar ("inner") product
y <- diag(x)
z <- matrix(1:12,ncol=3,nrow=4)
y%*%z
y%*%x
x%*%z

[Package base version 0.64.2 ]