contig: A function to compute the contiguity matrix

Description Usage Arguments Value See Also Examples

Description

The function is based on rgdal and spdep packages and can be used with a shape file or an R spatial object (SpatialPolygonsDataFrame).

Usage

1
contig(spatobj = NULL, folder = NULL, shape = NULL, queen = TRUE)

Arguments

spatobj

- a spatial object (SpatialPolygonsDataFrame) containing geographic information

folder

- a character vector with the folder (directory) name indicating where the shapefile with the geographic information is located.

shape

- a character vector with the name of the shapefile (without the .shp extension) which contains the geographic information

queen

= TRUE (by default) for queen criteria, FALSE for rook criteria

Value

A first order contiguity (adjacency) matrix, where each element [i,j] equals 1 if i-th and j-th spatial units are adjacent, 0 otherwise (queen or rook criteria)

See Also

Other spatial functions used for segregation indices computation: area, perimeter, distance, distcenter, boundaries

Examples

1
2
3
4
 contig(segdata) 
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'
contig(folder = foldername, shape = shapename)


Search within the OasisR package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.