October 2017
Beginner to intermediate
236 pages
7h 38m
English
There are several ways to create a matrix, but the most convenient way to create a matrix is through the use of the matrix() function from base R. Let's perform the following steps to learn about creating a matrix:
matA <- matrix(1, nrow=2, ncol=2) matB <- matrix(1:9, nrow=3, ncol=3, byrow=TRUE)
Vec1 <- 1:3 Vec2 <- 3:1
matC <- rbind(Vec1, Vec2)