From the course: R for Data Science: Lunch Break Lessons

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

crossprod

crossprod

- [Male Narrator] I don't know about you, but matrix multiplication is a difficult concept for me to keep straight. Especially since R has four different ways to multiply matrices. So, let's spend a little bit of time looking at each of the four ways and the differences of each. First, we need a couple of matrices to multiply, so I've created MatrixOne. Let's take a look at that one. And MatrixTwo. Now, I've deliberately kept these two really simple so we can understand what's going on later on. Now, in line 11, 12, 13, and 14, I've identified the four different ways of multiplying these two. So, let's look at the first one. MatrixOne times MatrixTwo is shown in line 11. I'm using just a very simple multiplication symbol and I run that. And what you'll find is just that this simple method of multiplication takes the value in row one, column one of MatrixOne and multiplies it against row one, column one of MatrixTwo.…

Contents