Well, I have searched a lot of questions but nothing works. Here is my question, I was asked to create a matrix like this
# [,1] [,2] [,3] [,4] [,5]
# [1,] 1 2 3 4 5
# [2,] 2 3 4 5 6
# [3,] 3 4 5 6 7
# [4,] 4 5 6 7 8
# [5,] 5 6 7 8 9
using the rep()
, matrix()
and seq()
function.
I want to add 1
to each repeating cycle in seq(1:5)
for 5 times, but I don't know how to. Would any one help me with this question?