distance: A function to compute the distance matrix between centroids...

distanceR Documentation

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

Description

The function is based on sf package and can be used with a shape file or an R spatial object (class sf, sfc or sfg).

Usage

distance(spatobj = NULL, folder = NULL, shape = NULL,
distin = 'm',  distout = 'm', diagval = '0')

Arguments

spatobj

- a spatial object (class sf, sfc or sfg) 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

distin

- input metric conversion, based on measurements package and includes conversions from 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

distout

- output metric conversion, based on measurements package and includes conversions to 'm', 'km', 'inch', 'ft', 'yd', 'mi', 'naut_mi', etc.

diagval

- the user has the choice of the definition of the diagonal: diagval = '0' (by default) for an 'empty' diagonal and diagval = 'a' to compute the diagonal as 0.6 * square root (spatial units area) (White, 1983)

Value

A matrix with the distance between centroids

See Also

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

Examples

 distance(segdata) 

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

OasisR documentation built on Aug. 30, 2023, 1:09 a.m.

Related to distance in OasisR...