Skip to content
Prev 164252 / 398506 Next

subset point data set by distance ranges

On Tue, 9 Dec 2008, David M Warner wrote:

            
You mean subsets of _pairs_ of points, right? (If not, then say what you 
meant and give an example.)

Do like this:
$`(0,1]`
       row col
  [1,]   2   1
  [2,]   5   1
  [3,]   6   1
  [4,]   9   1
  [5,]   1   2
  [6,]   3   2
[rest omitted]

Each element of the list contains all the pairs at the specified distance.

You'll want to clean this up to use the right distance and cutpoints and 
to rid redundant pairs (2,1 vs 1,2), but you get the idea.

See

 	?which
 	?cut
 	?levels
 	?sapply

HTH,

Chuck
Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901