Re: [R] Minimum distance

From: Douglas Bates <bates_at_stat.wisc.edu>
Date: Mon 18 Apr 2005 - 10:20:28 EST

Williams, Michael wrote:
> G'day, I have a matrix 20000 x 500 populated with all the distances
> between a list of airports and a list of towers. What I'm having trouble
> doing is finding the closest airport to each tower, Any help would be
> greatly appreciated.
>
> Regards,
> Michael Williams

Sounds like you want to apply the function which.min to the rows of the matrix. See

?apply

and

?which.min



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Apr 18 14:26:47 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:15 EST