View source: R/nearestNeighbors.R
knnVec | R Documentation |
Number of neighbors for each sample (vector) from a neighbor-pair matrix.
knnVec(neighbor.pairs.mat)
neighbor.pairs.mat |
two columns of redundant "i,j" pairs from nearestNeighbors function |
knn.vec vector number of nearest neighbors for each instance
neighbor.pairs.idx <- nearestNeighbors(
predictors.mat,
nbd.method = "multisurf",
nbd.metric = "manhattan",
sd.frac = 0.5
)
mean(knnVec(neighbor.pairs.idx)) # average number of neighbors
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.