[R] fast code

Timur Elzhov Timur.Elzhov at jinr.ru
Fri Dec 6 18:40:03 CET 2002


On Fri, Dec 06, 2002 at 01:12:27PM -0400, Pantelis Andreou wrote:

> I have two vectors x1 and x2 both in increasing order.
> I want to select the x1[j]th entry which is the max min of the x2[i]th
> entry. I can do this using if and for statements but is there a quick way
> to do it without running a loop?
Use `which' function:

x1[which(x2 == max(x2))]


WBR,
Timur.




More information about the R-help mailing list