Learn R Programming

OasisR (version 1.0.0)

contig: A function to compute the contiguity matrix

Description

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

Usage

contig(spatobj = NULL, folder = NULL, shape = NULL)

Arguments

spatobj
- a Spatial object (SpatialPolygonsDataFrame)
folder
- a character vector with the folder (directory) where the shapefile is
shape
- a character vector with the name of the shapefile (without the .shp extension)

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

See Also

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

Examples

Run this code
contig(GreHSize)

foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'GreHSize'
contig(folder = foldername, shape = shapename)

Run the code above in your browser using DataLab