I have a vector like this :
Sum<-c(24, 32, 40, 48, 56, 28, 36, 44, 52, 60)
now i want to make a matrix of this vector like the first 5 values of the vector should become the first row of the matrix and the rest five as second row like this.
1 2 3 4 5
1 24 32 40 48 56
2 28 36 44 52 60
when i use the matrix function it gives me output like this which i don’t want:
[,1] [,2] [,3] [,4] [,5]
[1,] 24 40 56 36 52
[2,] 32 48 28 44 60
Is there a way to get the desired output??
Thanks for any help.
Use the
byrowparameter of matrixSee
?matrixfor more help