# R Programming for Beginners: Leveraging R with Matrices, Arrays, & Lists

R Programming    |    Beginner
• 14 videos | 1h 36m 19s
• Includes Assessment
Rating 4.2 of 34 users (34)
Vectors are a great basic data structure in R, but they have important limitations on the dimensions and types of data they contain. Matrices, arrays, and lists are powerful R structures that mitigate these limitations. This course will help you distinguish each of these three elements' purpose and show you how to use them. You'll start by using matrices to store two-dimensional data. You'll then differentiate between row-major and column-major matrices. You'll learn how to use arrays and how you can easily create three-dimensional arrays as you can two-dimensional arrays. You'll then move on to the use of lists and how they differ from vectors. After taking this course, you'll be able to identify when and how to use a matrix, a list, and an array.

## WHAT YOU WILL LEARN

• Discover the key concepts covered in this course Use matrices to store 2-dimensional data and index into them Name dimensions in matrices and index into them using names Perform cell-wise math operations on data stored in matrices Implement matrix multiplication using the %*% operator Join and rearrange matrices using rbind(), dim(), and columnbind() Perform indexing and math operations on matrices
• Create arrays and store multi-dimensional data in them Index into arrays using both the indices and the index labels Create lists and perform indexing operations Use lists with name-value pairs Add, edit, and remove the names and values in lists Create lists containing data of different types Summarize the key concepts covered in this course

## IN THIS COURSE

• In this video, you’ll learn more about your instructor and this course. In this course, you’ll learn how matrices can be used in R to store two-dimensional data. You'll discover the difference between the row-major and column-major representations of matrices. You’ll also learn how to index into matrix objects. You'll work with matrix multiplication to see how to change the dimensions of a matrix object.
• In this video, you’ll learn more about matrices. In this demo, you’ll learn that a vector can be thought of as a one-dimensional representation of data, matrices can be thought of as two-dimensional data structures. You’ll first employ the question mark operator to get the R documentation on the matrix object. Onscreen, you’ll see documentation that shows you can use the matrix function to create a matrix from a given set of values.
• 3.  Naming Dimensions in R Matrices
In this video, you’ll watch a demo. In this demo, you’ll start by working with dimensions and dimension names. You’ll see onscreen your first input argument into the invocation of the matrix function is the data 101:106. You’ll see from the matrix onscreen this has been organized into a matrix with two rows and three columns. These are from the second input argument you passed into the matrix function.
• 4.  Performing Math Operations on R Matrices
In this video, you’ll watch a demo. In this demo, you’ll turn your attention to other kinds of matrix operations, starting with assignments. You’ll begin by creating a simple matrix you can use in our experiments. Onscreen now, you have a matrix. It's called matrix.a. You’ll pass in a vector with four values using the c function. These are 100, 200, 300 and 400.
• 5.  Implementing Matrix Multiplication in R
In this video, you’ll watch a demo. In this demo, you’ll pick up where you left off at the end of the last demo. You’ll learn about the matrix multiplication operator and use it to perform the multiplication of two matrices, using those you defined in the previous demo. First, you’ll examine the value of matrix.a, which gives you a two by two matrix. This means it has two rows and two columns.
• 6.  Combining Matrices in R
In this video, you’ll watch a demo. In this demo, you’ll move on from matrix multiplication to other matrix operations. You’ll start with resizing and changing the dimensionality of an existing matrix. You’ll begin by examining the contents of matrix.d. You created this matrix in the previous demo. It has two rows and three columns. You’ll learn how to change the dimensions to turn it into a matrix with three rows and two columns.
• 7.  Performing Indexing Operations on R Matrices
In this video, you’ll watch a demo. In this demo, you’ll learn how to extract parts of a matrix. Onscreen now, you’ll see how to invoke the indexing operator on the variable matrix.rowbind. You’ll see the indexing operator takes in a pair of numbers. You’ve specified first a row number, which is 1, and then a range of column numbers, 1:3. Remember that 1:3 is effectively equivalent to the vector 1, 2, and 3.
• 8.  Creating Arrays in R
In this video, you’ll watch a demo. In this demo, you’ll turn your attention from matrices to arrays. You’ll see a matrix is actually a special case of an array. You’ll begin by using the question mark operator followed by the word array. You’ll see this opens up the R documentation for arrays. Onscreen, you’ll see you can create an array using the function called array. In addition, you’ll learn about functions called as.array.
• 9.  Indexing into R Arrays
In this video, you’ll watch a demo. Onscreen, you’ll see the three-dimensional array. You’ll see it’s been broken down into two two-dimensional matrix objects. These are labeled Midterm and Final. You’ll see the row names and the column names of these two-dimensional matrix objects are the same. You’ll see the row names are Julia, James, and Joe. For the column names, you have Math and English. This array is a three-dimensional one.
• 10.  Using Lists in R
In this video, you’ll watch a demo. Onscreen, you’ll see code which you used to create your three-dimensional array. In the input argument called dimnames, you’ll see it’s been associated with a list. That list has three vectors as its elements. Each of those vectors is defined using the function c and hold the row names, the column names, or the table name.
• 11.  Specifying Key-Value Pairs in R Lists
In this video, you’ll watch a demo. In this demo, you’ll continue working with lists. You’ll learn how to specify descriptive names for each of the elements in a list. Onscreen, you’ll see a new variable called claudia.list has been defined. This involves using the list function, but the difference is, you now have individual key value pairs corresponding to the items you’ll place in the list.
• 12.  Editing Keys and Values in R Lists
In this video, you’ll watch a demo. In this demo, you’ll pick up where you left off at the end of the last demo. You’ll continue with various list operations. You’ll use the list you added various named properties into it. Taking another look at this list, you’ll there’s also one unnamed property. This is the value Economics that's been added in at index position 6.
• 13.  Exploring R Lists with Different Data Types
In this video, you’ll watch a demo. In this demo, you’ll define recursive lists. Onscreen, you’ll see a variable called course.list. This has two elements. The first is named ids. The second is named courses. These elements also represent lists. ids is a list containing the vector with numbers 101 through 107. And courses is a list with the strings R, Python, Java and C++.
• 14.  Course Summary
In this video, you’ll summarize what you’ve learned in this course. You’ve learned the use of matrices to store two-dimensional data. You learned matrices are in column major form, meaning the specified values are filled in by the column. You can also create row major matrices where the rows are first filled in by the row. Then, you learned to name the rows and columns and index into specific cells using those names.

## EARN A DIGITAL BADGE WHEN YOU COMPLETE THIS COURSE

Skillsoft is providing you the opportunity to earn a digital badge upon successful completion on some of our courses, which can be shared on any social network or business platform.

Digital badges are yours to keep, forever.