vec <- c(1, 2, 3, 1, 0, 2, 3, 1, 1)
m1 <- matrix(vec, nrow = 3, ncol = 3)
vec <- c(2, 1, 3, 0, 0, 1, 2, 1, 0)
m2 <- matrix(vec, nrow = 3, ncol = 3)
add <- m1 + m2
print(m1)
print(m2)
print(add)
# run:
#
# [,1] [,2] [,3]
# [1,] 1 1 3
# [2,] 2 0 1
# [3,] 3 2 1
# [,1] [,2] [,3]
# [1,] 2 0 2
# [2,] 1 0 1
# [3,] 3 1 0
# [,1] [,2] [,3]
# [1,] 3 1 5
# [2,] 3 0 2
# [3,] 6 3 1
#