Finding the index inside a vector satisfying a condition

Use which and take the first element of the result:

which(b > 0.65)[1]
#[1] 3

Leave a Comment