Skip to content

How to create a "nb" object?

2 messages · René Eschen, Roger Bivand

#
On Thu, 19 Feb 2004, Ren? Eschen wrote:

            
If you have points that represent your data observations, you can use
triangulation-based functions like: tri2nb, gabrielneigh, relativeneigh,
soi.graph, graph2nb; distance-based neighbours from dnearneigh; k-nearest
neighbours from knn2nb and knearneigh. If you have polygons, you can find
contiguous polygons with poly2nb;  and cell2nb will give you an nb object
for a regular grid.

Which you choose will depend on your research problem and how your data 
are structured. Some can generate observations with no neighbours 
(especially the distance-based schemes). You can also export neighbour 
lists in "GAL" format from programs like GeoDa for use in spdep in R.

Roger