pick.min.max {nnspat} | R Documentation |
Smallest and Largest Distances in a Distance Matrix
Description
This function finds and returns the k
smallest and k
largest distances in a distance matrix or distance object,
and also provides pairs of objects these distances correspond to.
The code is adapted from
http://people.stat.sc.edu/Hitchcock/chapter1_R_examples.txt.
Usage
pick.min.max(ds, k = 1)
Arguments
ds |
A distance matrix or a distance object |
k |
A positive integer representing the number of (min and max) distances to be presented, default is |
Value
A list
with the elements
min.dis |
The |
ind.min.dis |
The indices (i.e., row numbers) of the |
max.dis |
The |
ind.max.dis |
The indices (i.e., row numbers) of the |
Author(s)
Elvan Ceyhan
See Also
dist
, ipd.mat
, and ipd.mat.euc
Examples
n<-20 #or try sample(1:20,1)
Y<-matrix(runif(3*n),ncol=3)
ipd<-ipd.mat(Y)
pick.min.max(ipd)
#or
pick.min.max(dist(Y))
pick.min.max(ipd,2)
[Package nnspat version 0.1.2 Index]