我目前有两个矩阵:
[,1]
[1,] 0
[2,] 5
[3,] 1
和
[,1] [,2] [,3]
[1,] 0 0 1
[2,] 0 9 9
[3,] 1 1 1
it is possible to move rows automatically horizontal to the right by step of number on first matrix 和 all empty site complete 0? The result will be like that:
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,] 0 0 1 0 0 0 0 0
[2,] 0 0 0 0 0 0 9 9
[3,] 0 1 1 1 0 0 0 0