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.

Matrix SVD and QR decomposition

Matrix SVD and QR decomposition

- [Instructor] Now, I'll admit upfront that I have a sketchy, at best, understanding of matrix decomposition but I know that many people watching this course have a deep technical understanding but are new to R and you may not know that R has the ability to calculate both an SVD and a QR decomposition. So I'm going to go through the process of showing you how to use these two functions to do decomposition. Let's start with a matrix. I've defined one here and I'm going to run it and put it into the environment. Let's take a quick look at that matrix so we know what it looks like. Fairly simple. Now, to calculate the singular value decomposition of this matrix is simplicity. It's svd and the name of the matrix. And that returns the d, the u and the v components of the original matrix. If you're used to dealing with matrix decompositions, you'll understand what to do with these three components. Let's move on…

Contents