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.

matplot

matplot

- [Instructor] A matrix is a two-dimensional collection of data. It has rows, and it has columns. There are times when you're going to want to compare the columns of one matrix to the columns of another matrix. And for that, R provides something called matplot. Let's take a look at how that works. First off, I've created two matrices, titled matrix1 and matrix2. Let's take a look at the contents. Matrix1 has two columns. The first column is one, two, three, four, five, six, seven, eight, as is the second column. In the second matrix, we have two columns, but this time the numbers are a little bit more random. The first column is four, six, one, seven, 12, nine, 13, 15, and you can see the second column for yourself. Let's compare those two using matplot. And to do that, I type in matplot, parentheses, the first column, a comma, and then the second matrix. And then I hit Return, and we're presented with a plot of the two matrices. Now, to read this, what you're seeing across the bottom…

Contents