Learn R Programming

spdep (version 0.1-10)

tri2nb: Neighbours list from tri object

Description

The function uses the tripack package to convert a matrix of two-dimensional coordinates into a neighbours list of class nb with a list of integer vectors containing neighbour region number ids.

Usage

tri2nb(coords, row.names = NULL)

Arguments

coords
matrix of point coordinates with two columns
row.names
character vector of region ids to be added to the neighbours list as attribute region.id, default seq(1, nrow(x))

Value

  • The function returns an object of class nb with a list of integer vectors containing neighbour region number ids.

See Also

knn2nb

Examples

Run this code
require(tripack)
data(columbus)
col.tri.nb <- tri2nb(coords, row.names=rownames(columbus))
plotpolys(polys, bbs, border="grey")
plot(col.tri.nb, coords, add=TRUE)
title(main="Raw triangulation links")

Run the code above in your browser using DataLab