distcenter: A function to compute the distance from spatial units...

distcenterR Documentation

A function to compute the distance from spatial units centroids to the center

Description

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

Usage

distcenter(spatobj = NULL, folder = NULL, shape = NULL, 
center = 1, distin = 'm',  distout = 'm')

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

center

the row number of the center

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.

Value

A vector with the distance to the center's centroid

See Also

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

Examples

distcenter(segdata, center = 46) 
foldername <- system.file('extdata', package = 'OasisR')
shapename <- 'segdata'
distcenter(folder = foldername, shape = shapename, center = 19)

OasisR documentation built on April 3, 2025, 5:58 p.m.

Related to distcenter in OasisR...