Computes the nearest neighbors of descriptors in an FPset or APset object for use with the jarvisPatrick
clustering
function. Only one of numNbrs
or cutoff
should be given, cutoff
will take precedence if
both are given. If numNbrs
is given, then that many neighbors will be returned for each item in the set.
If cutoff
is given, then, for each item X, every neighbor that has a similarity value greater than or equal to
the cutoff will be returned in the neighbor list for X.
1  nearestNeighbors(x, numNbrs = NULL, cutoff = NULL, ...)

x 
Either an FPset or an APset. 
numNbrs 
Number of neighbors to find for each item. If not enough neighbors can be found the matrix will be padded with NA. 
cutoff 
The minimum similarity value an item must have to another item in order to be included in that
items neighbor list. This parameter takes precedence over 
... 
These parameters will be passed into the distance function used, either 
The return value is a list with the following components:
indexes 
index values of nearest neighbors, for each item. If 
names 
The names of each item in the set, as returned by cid 
similarities 
The similarity values of each neighbor to the item for that row.
This will also be either a list of lists or a matrix, depending on whether or not

Kevin Horan
1 2 3 4  data(sdfsample)
ap = sdf2ap(sdfsample)
nnm = nearestNeighbors(ap,cutoff=0.5)
clustering = jarvisPatrick(nnm,k=2,mode="a1b")

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.