I have a matrix, and I want to create a list with the selected rows of this matrix, which are elements of the list.
For example, this is my matrix
my.matrix=matrix(1:100, nrow=20)
and I want to create a list from this matrix so that each element of this list is part of the matrix and the row index of each part is defined
my.n=c(1,2,4,3,5,5)
So the first element of my list should be
my.matrix[1,]
second
my.matrix[2:3,]
etc.
How to do it in an elegant way?
source share