O'Reilly logo

R in Action by Robert Kabacoff

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix E. Matrix Algebra in R

Many of the functions described in this book operate on matrices. The manipulation of matrices is built deeply into the R language. Table E.1 describes operators and functions that are particularly important for solving linear algebra problems. In the following table, A and B are matrices, x and b are vectors, and k is a scalar.

Table E.1. R functions and operators for matrix algebra

Operator or Function

Description

+ - * / Λ Element-wise addition, subtraction, multiplication, division, and exponentiation, respectively.
A %*% B Matrix multiplication.
A %o% B Outer product. AB'.
cbind(A, B, ...) Combine matrices or vectors horizontally.
chol(A) Choleski factorization of A. If R <- chol(A), then chol(A) contains ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required