Skip to content
Justice Tech School

Matrices

A matrix is a two dimensional vector of one type. matrix() builds it.

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

Exercise

Matrix size.

(m)

Quiz Test

What does t(m) do?

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