You can use the which()
function in R to satisfy your condition. Create some test data:
> test
X1 X2 X3 X4
1 9.725585 10.067146 9.473320 9.959529
2 10.104124 11.278900 9.299356 10.317570
3 8.770733 11.092994 9.803285 12.078180
4 10.163150 9.233452 9.425293 9.968435
5 9.815270 9.932501 9.798252 9.194674
6 10.635158 9.175388 10.938356 10.611528
7 10.959444 7.766411 8.955005 10.712767
8 9.907442 10.123078 9.897276 10.467526
9 9.337628 10.811072 11.062031 10.426313
10 10.056789 11.029007 10.875958 11.160633
using which(test < 10, arr.ind = TRUE)
gives:
> head(which(test < 10, arr.ind = TRUE))
row col
[1,] 1 1
[2,] 3 1
[3,] 5 1
[4,] 8 1
[5,] 9 1
[6,] 4 2
Then:
> sort(unique(which(test < 10, arr.ind = TRUE)[, 1]))
[1] 1 2 3 4 5 6 7 8 9