diffnb

0th

Percentile

Differences between neighbours lists

The function finds differences between lists of neighbours, returning a nb neighbour list of those found

Keywords
spatial
Usage
diffnb(x, y, verbose=NULL)
Arguments
x
an object of class nb
y
an object of class nb
verbose
default NULL, use global option value; report regions ids taken from object attribute "region.id" with differences
Value

A neighbours list with class nb

Aliases
  • diffnb
Examples
example(columbus)
coords <- coordinates(columbus)
rn <- sapply(slot(columbus, "polygons"), function(x) slot(x, "ID"))
knn1 <- knearneigh(coords, 1)
knn2 <- knearneigh(coords, 2)
nb1 <- knn2nb(knn1, row.names=rn)
nb2 <- knn2nb(knn2, row.names=rn)
diffs <- diffnb(nb2, nb1)
plot(columbus, border="grey")
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")
Documentation reproduced from package spdep, version 0.6-9, License: GPL (>= 2)

Community examples

Looks like there are no examples yet.