[R] Selecting closest values

P_M pmartinu at broadpark.no
Sun Mar 22 19:04:42 CET 2009


Yes, of course.

ID	loc	
1	144	
2	144	
3	140	
4	126	
5	120	
6	112		
7	100	
8	99	
9	91	
11	90		
12	90		
13	89		
15	86		
16	85		
17	85		
18	80	
19	79	
20	79	
21	78	
22	78		
23	76	
24	74	
25	73	
26	72		
27	71	
28	68	
29	68	
30	68
.	.	
.	.
185	-22	


P_M wrote:
> 
> Hi
> I have a table with ID (1 to 183) and Location (144 to -22).
> My problem is that I want to select the 10 ID's that are closest in
> Location to ID 1, ID 2 and so on.
> Also, some ID have the same Location. Say, if 11 ID's are closest to ID
> 100 I want to randomly choose one of the ID's to select 10 ID's total.
> 
> Thank you
> 
>  
> 
> 

-- 
View this message in context: http://www.nabble.com/Selecting-closest-values-tp22647126p22648754.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list