powered by
knearneigh(x, k=1)
knn
dnearneigh
knn2nb
data(columbus) col.knn <- knearneigh(coords, k=4) plotpolys(polys, bbs, border="grey") plot(knn2nb(col.knn), coords, add=TRUE) title(main="K nearest neighbours, k = 4")
Run the code above in your browser using DataLab