What does the which() function do ?
which()
Returns the index of all elements in a vector or array matching the condition
> v1 [1] 1 2 3 4 5 6 7 8 9 10 > which(v1 > 5) [1] 6 7 8 9 10