Multiplies two matrices, if they are conformable. If one argument is a vector, it will be promoted to either a row or column matrix to make the two arguments conformable. If both are vectors of the same length, it will return the inner product (as a matrix).
x %*% y
numeric or complex matrices or vectors.
When a vector is promoted to a matrix, its names are not
promoted to row or column names, unlike
This operator is S4 generic but not S3 generic. S4 methods need to be
written for a function of two arguments named
A double or complex matrix product. Use
drop to remove
dimensions which have only one level.
Since R 3.2.0, promotion of a vector to a 1-row or 1-column matrix
happens in even more cases, when one of the two choices allows
y to get conformable dimensions.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.
For matrix crossproducts,
tcrossprod() are typically preferable.
1 2 3 4 5 6 7 8 9