How to fill the element of matrix row wise in R?

r

#1

I have created a matrix of numbers from 1 to 9 but in matrix numbers are arranged column wise.I want to fill the numbers row wise.

matrix(1:9, nrow = 3)

     [,1] [,2] [,3]
[1,]    1    4    7
[2,]    2    5    8
[3,]    3    6    9

#2

hello @sid100158,

Hope this helps!