diffnb                 package:spdep                 R Documentation

_D_i_f_f_e_r_e_n_c_e_s _b_e_t_w_e_e_n _n_e_i_g_h_b_o_u_r_s _l_i_s_t_s

_D_e_s_c_r_i_p_t_i_o_n:

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

_U_s_a_g_e:

     diffnb(x, y, verbose=TRUE)

_A_r_g_u_m_e_n_t_s:

       x: an object of class 'nb'

       y: an object of class 'nb'

 verbose: report regions ids taken from object attribute "region.id"
          with differences

_V_a_l_u_e:

     A neighbours list with class 'nb'

_A_u_t_h_o_r(_s):

     Roger Bivand Roger.Bivand@nhh.no

_E_x_a_m_p_l_e_s:

     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")

