diffnb {spdep} | R Documentation |
The function finds differences between lists of neighbours, returning a nb
neighbour list of those found
diffnb(x, y, verbose=TRUE)
x |
an object of class nb |
y |
an object of class nb |
verbose |
report regions ids taken from object attribute "region.id" with differences |
A neighbours list with class nb
Roger Bivand Roger.Bivand@nhh.no
data(columbus) knn1 <- knearneigh(coords, 1) knn2 <- knearneigh(coords, 2) nb1 <- knn2nb(knn1, row.names=rownames(columbus)) nb2 <- knn2nb(knn2, row.names=rownames(columbus)) diffs <- diffnb(nb2, nb1) library(maptools) plot(polys, border="grey", forcefill=FALSE) plot(nb1, coords, add=TRUE) plot(diffs, coords, add=TRUE, col="red", lty=2) title(main="Plot of first (black) and second (red)\nnearest neighbours")