Skip to content
Justice Tech School

R Matrices

A matrix is a 2D structure of one type. Create with matrix(). Use dim, t (transpose) and %*% for matrix multiplication.

Example
m <- matrix(1:6, nrow = 2)
print(m); print(dim(m)); print(t(m)); print(m[2, 3])

Exercise

Matrix size.

(m)

Quiz Test

Which transposes a matrix?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.