Description Usage Arguments Value Examples
View source: R/measure_segregation.R
Calculate segregation metrics
1 2 3 4 5 6 | measure_segregation(
data,
id_field = "id",
distance_method = "geodist",
bandwidths = 0
)
|
data |
a spatial sf object of the study area divided into areal units (such as census tracts), containing the columns 'id', 'geometry', and one column per population group indicating that group's population in the local areal unit. |
id_field |
character. The name of the identificator column in the input data. Defaults to 'id'. |
bandwidth |
numeric. A bandwidth, in meters, used to set the scale of analysis for spatial segregation measurement. When set to 0, aspatial metrics will be calculated. |
a segreg object, a list containing the input spatial data and the results of the segregation metrics.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | library(sf)
library(segregr)
# load sample data from package segregr
marilia_sf <- st_read(system.file("extdata/marilia_2010.gpkg", package = "segregr"))
# calculate segregation metrics
segregation <- measure_segregation(marilia_sf)
# global dissimilarity index
segregation$D
# global entropy
segregation$E
# global information theory index H
segregation$H
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.