Skip to content
Prev 323095 / 398502 Next

Extracting elements from a matrix using a vector containing indices

On May 7, 2013, at 06:39 , Mark Coletti wrote:

            
As Berend says, you're not specifying the problem very clearly. Are you looking for something like this (indexing with a matrix)?
[,1] [,2] [,3] [,4] [,5]
[1,]   29   19   18   13    0
[2,]   24   24   11   25   10
[3,]   20    9   12   11   24
[4,]   28    3   16   17   32
[1] 3 2 2 4 3
[1] 20 24 11 17 24