[R-sig-Geo] Fill in empty links with nearest neighbors

Roger Bivand Roger.Bivand at nhh.no
Mon Jul 18 20:21:10 CEST 2011

On Thu, 14 Jul 2011, Kitty Lee wrote:

> Hi. I have a shapefile. I guess because of cartography problem, the 
> border of some of the units that are supposed to be physically connected 
> are 'snapped' properly. As a result, when I use poly2nb, there are empty 
> links.

Did you notice on the help page for poly2nb() that you can snap within the 
function? Had you quoted your code verbatim, and added the output of 
sessionInfo(), replying would have been easier. If you did use the snap= 
argument, are your polygons malformed? Can you clean then in a topological 
GIS first?

Hope this helps,


> I know I can set zero.policy=T in nb2listw. But I'm trying to use 
> skater() function. I notice that it won't accept spatial weight matrix 
> with empty link.
> Any advice on how can I easily fix the matrix? Is there a way I can fill 
> in empty link with nearest neighbors?
> I'd really appreciate advice on how to manually tweak the connectivity 
> matrix.
> Thanks in advance!
> K.
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no

More information about the R-sig-Geo mailing list