lokheart lokheart - 10 months ago 25
R Question

The R %*% operator

What is this? I can't find help by using

. (Sorry for being dumb)

> 1%*%1
[1,] 1
> 10%*%10
[1,] 100
> c(1:2)%*%c(1:2)
[1,] 5

Answer Source

It's a matrix multiplication operator!

From the documentation:


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


x, y    numeric or complex matrices or vectors

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download