Skip to content
Prev 315410 / 398503 Next

matrix manipulation with its rows

Not a great solution, I don't think, but:

 > kronecker(diag(2), matrix(1:6, 2, byrow=TRUE))[c(1,4),]
      [,1] [,2] [,3] [,4] [,5] [,6]
[1,]    1    2    3    0    0    0
[2,]    0    0    0    4    5    6

So using a function that does this in 'lapply'
should solve the problem you state.  I'm guessing
the real problem might be more complex.

Pat
On 16/01/2013 07:59, Kathryn Lord wrote: