GNU Rの配列で条件に沿った添字を取り出し

whichを使うとかなりいろいろなことができる:

tmpMatrix <- array(1:20, c(30,2))
which(tmpMatrix[,1] == 2)
tmpMatrix[which(tmpMatrix[,1] == 2) ,]
which(tmpMatrix[,1] == 10 & tmpMatrix[,2] == 20)
tmpMatrix[which(tmpMatrix[,1] == 10 & tmpMatrix[,2] == 20),]
which(tmpMatrix[,1] == 19 | tmpMatrix[,2] == 1)
tmpMatrix[which(tmpMatrix[,1] == 19 | tmpMatrix[,2] == 1),]