Working With Matrices
In this lesson, you will learn about a data structure that is formed from combining more than one vector: the matrix, and matrices in R. Like vectors, matrices hold data of one type. But unlike vectors, matrices are two-dimensional and consist of rows and columns, while vectors are one dimensional.
After completing this lesson about matrices in R, you will be able to compare and contrast vectors and matrices. You will learn how you can name matrix rows and columns and figure out the dimensions of a matrix. Towards the end of the lesson, you will learn how you can index matrices to find specific values as well as how to subset the matrix by its rows and columns — all critical skills for using R to do data analysis.
After you finish this lesson on matrices in R, you will be well-equipped to start building simple programs in R; what you build is limited by the depth of your imagination. If you have trouble coming up with ideas, you can practice by following this tutorial to build a simple calculator and maybe some additional ideas for programs will come to mind.
1. Matrices: Two-Dimensional Data Structures
2. Combining Vectors into Matrices
3. Naming Matrix Rows and Columns
4. Finding Matrix Dimensions
5. Adding Columns to Matrices
6. Indexing Matrices By Element
7. Subsetting Matrices by Rows and Columns
8. Ranking Universites
9. Scoring and Ranking Universities
10. Next Steps