Module # 6 Doing math in R part 2
This week was more on matrixes in R. For step one we had to make 2 matrixes and then add and subtract them. A = matrix(c(2,0,1,3), ncol=2) B = matrix(c(5,2,4,-1), ncol=2) A + B A - B Next I was instructed to make a matrix " matrix of size 4 with the following values in the diagonal 4,1,2,3." matrix1 <- diag(c(4, 1, 2, 3)) Finally I was asked to make a very specific matrix using Diag M <- diag(3, 5) M[1, ] <- c(3, 1, 1, 1, 1) M[2:5, 1] <- 2