Learn R Programming

OasisR (version 1.0.0)

distance: A function to compute the distance matrix between centroids of spatial units

Description

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

Usage

distance(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 matrix with the distance between spatial units centroids

See Also

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

Examples

Run this code
distance(GreHSize)

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

Run the code above in your browser using DataLab