powered by
This function finds the m nearest neighbors, given a matrix of distances.
mNearestN(distMat, m = 5, listv = FALSE, rn = FALSE)
spatial weights matrix
list of indexes of the m nearest neighbors
distance matrix
number of nearest neighbors, default value 5
logical, default FALSE. If TRUE the list of neighbors should also be returned
logical, default FALSE. If TRUE, the spatial weights matrix will be row-normalized
Rozeta Simonovska
data(gN3dist, package = "SDPDmod") fournn <- mNearestN(gN3dist, m = 4) mat1 <- rownor(fournn) tennn <- mNearestN(gN3dist, 10, listv = TRUE, rn = TRUE) mat2 <- tennn$W
Run the code above in your browser using DataLab