ETA: the point of the below, by the way, is to not have to iterate through my entire set of column vectors, just in case that was a proposed solution (just
Basically data[, 2:3]==4
gave you the index for data[,2:3]
instead of data
:
R > data[, 2:3] ==4
var1 var2
[1,] FALSE FALSE
[2,] FALSE FALSE
[3,] FALSE FALSE
[4,] TRUE TRUE
[5,] FALSE TRUE
[6,] FALSE TRUE
[7,] FALSE FALSE
[8,] FALSE FALSE
[9,] FALSE FALSE
So you may try this:
R > data[,2:3][data[, 2:3] ==4]
[1] 4 4 4 4