[R] Position in a vector of the last value > n

Thaden, John J ThadenJohnJ at uams.edu
Thu Jul 10 14:41:07 CEST 2008


This shouldn't be hard, but it's just not
coming to me:
Given a vector, e.g., 
v <- c(20, 134, 45, 20, 24, 500, 20, 20, 20)
how can I get the index of the last value in
the vector having a value greater than n, in 
this case, greater than 20?  I'm looking for
an efficient function I can use on very large
matrices, as the FUN argument in the apply()
command.  

Confidentiality Notice: This e-mail message, including a...{{dropped:8}}



More information about the R-help mailing list