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

From: Thaden, John J <ThadenJohnJ_at_uams.edu>
Date: Thu, 10 Jul 2008 07:41:07 -0500

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}}



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 10 Jul 2008 - 13:37:44 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 11 Jul 2008 - 03:32:05 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive