Title: | Calculate Diversity and Segregation Indices |
---|---|
Description: | Implements common measures of diversity and spatial segregation. This package has tools to compute the majority of measures are reviewed in Massey and Denton (1988) <doi:10.2307/2579183>. Multiple common measures of within-geography diversity are implemented as well. All functions operate on data frames with a 'tidyselect' based workflow. |
Authors: | Christopher T. Kenny [aut, cre] |
Maintainer: | Christopher T. Kenny <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.0 |
Built: | 2024-10-09 05:46:12 UTC |
Source: | https://github.com/christopherkenny/divseg |
This data contains 2010 Census data for each of the three counties in DE.
data("de_county")
data("de_county")
An sf dataframe with 3 observations
data('de_county')
data('de_county')
This data contains 2010 Census data for each of the 218 tracts in DE.
data("de_tract")
data("de_tract")
An sf dataframe with 218 observations
data('de_tract')
data('de_tract')
Compute Absolute Centralization
ds_abs_cent(.data, .cols, .name) abs_cent(..., .data = dplyr::across(everything()))
ds_abs_cent(.data, .cols, .name) abs_cent(..., .data = dplyr::across(everything()))
.data |
tibble with sf geometry |
.cols |
|
.name |
name for column with absolute centralization. Leave missing to return a vector. |
... |
arguments to forward to ds_abs_cent from abs_cent |
a tibble or numeric vector if .name missing
data('de_county') ds_abs_cent(de_county, c(pop_white, starts_with('pop_'))) ds_abs_cent(de_county, c(pop_white, starts_with('pop_')), 'abs_cent')
data('de_county') ds_abs_cent(de_county, c(pop_white, starts_with('pop_'))) ds_abs_cent(de_county, c(pop_white, starts_with('pop_')), 'abs_cent')
Compute Absolute Clustering
ds_abs_clust(.data, .cols, .name) abs_clust(..., .data = dplyr::across(everything()))
ds_abs_clust(.data, .cols, .name) abs_clust(..., .data = dplyr::across(everything()))
.data |
tibble with sf geometry |
.cols |
|
.name |
name for column with absolute clustering. Leave missing to return a vector. |
... |
arguments to forward to ds_abs_clust from abs_clust |
a tibble or numeric vector if .name missing
data('de_county') ds_abs_clust(de_county, c(pop_white, starts_with('pop_'))) ds_abs_clust(de_county, c(pop_white, starts_with('pop_')), 'abs_clust')
data('de_county') ds_abs_clust(de_county, c(pop_white, starts_with('pop_'))) ds_abs_clust(de_county, c(pop_white, starts_with('pop_')), 'abs_clust')
Compute Absolute Concentration
ds_abs_conc(.data, .cols, .name) abs_conc(..., .data = dplyr::across(everything()))
ds_abs_conc(.data, .cols, .name) abs_conc(..., .data = dplyr::across(everything()))
.data |
tibble with sf geometry |
.cols |
|
.name |
name for column with absolute concentration. Leave missing to return a vector. |
... |
arguments to forward to ds_abs_conc from abs_conc |
a tibble or numeric vector if .name missing
data('de_county') ds_abs_conc(de_county, c(pop_black, starts_with('pop_'))) ds_abs_conc(de_county, c(pop_black, starts_with('pop_')), 'abs_conc')
data('de_county') ds_abs_conc(de_county, c(pop_black, starts_with('pop_'))) ds_abs_conc(de_county, c(pop_black, starts_with('pop_')), 'abs_conc')
Compute Atkinson b Index
ds_atkinson(.data, .cols, .name, b = 0.5) atkinson(..., .data = dplyr::across(everything()))
ds_atkinson(.data, .cols, .name, b = 0.5) atkinson(..., .data = dplyr::across(everything()))
.data |
|
.cols |
|
.name |
name for column with Atkinson b index. Leave missing to return a vector. |
b |
Default 0.5. Exponent parameter b, where 0 <= b <= 1. |
... |
arguments to forward to ds_atkinson from atkinson |
a tibble or numeric vector if .name missing
data('de_county') ds_atkinson(de_county, c(pop_white, starts_with('pop_'))) ds_atkinson(de_county, starts_with('pop_'), 'atkinson')
data('de_county') ds_atkinson(de_county, c(pop_white, starts_with('pop_'))) ds_atkinson(de_county, starts_with('pop_'), 'atkinson')
Compute Blau's Index
ds_blau(.data, .cols, .name) blau(..., .data = dplyr::across(everything()))
ds_blau(.data, .cols, .name) blau(..., .data = dplyr::across(everything()))
.data |
|
.cols |
|
.name |
name for column with Blau index. Leave missing to return a vector. |
... |
arguments to forward to ds_blau from blau |
a tibble or numeric vector if .name missing
data('de_county') ds_blau(de_county, starts_with('pop_')) ds_blau(de_county, starts_with('pop_'), 'blau')
data('de_county') ds_blau(de_county, starts_with('pop_')) ds_blau(de_county, starts_with('pop_'), 'blau')
Compute Correlation Index
ds_correlation(.data, .cols, .name) correlation(..., .data = dplyr::across(everything()))
ds_correlation(.data, .cols, .name) correlation(..., .data = dplyr::across(everything()))
.data |
|
.cols |
|
.name |
name for column with Correlation index. Leave missing to return a vector. |
... |
arguments to forward to ds_correlation from correlation |
a tibble or numeric vector if .name missing
data('de_county') ds_correlation(de_county, c(pop_white, starts_with('pop_'))) ds_correlation(de_county, starts_with('pop_'), 'correlation')
data('de_county') ds_correlation(de_county, c(pop_white, starts_with('pop_'))) ds_correlation(de_county, starts_with('pop_'), 'correlation')
Compute Distance Decay Interaction
ds_dd_interaction(.data, .cols, .name, .comp = FALSE) dd_interaction(..., .data = dplyr::across(everything()))
ds_dd_interaction(.data, .cols, .name, .comp = FALSE) dd_interaction(..., .data = dplyr::across(everything()))
.data |
tibble with sf geometry |
.cols |
|
.name |
name for column with distance decay interaction. Leave missing to return a vector. |
.comp |
Default is FALSE. FALSE returns the sum, TRUE returns the components. |
... |
arguments to forward to ds_dd_interaction from dd_interaction |
a tibble or numeric vector if .name missing
data('de_county') ds_dd_interaction(de_county, c(pop_black, starts_with('pop_'))) ds_dd_interaction(de_county, c(pop_black, starts_with('pop_')), 'dd_interaction')
data('de_county') ds_dd_interaction(de_county, c(pop_black, starts_with('pop_'))) ds_dd_interaction(de_county, c(pop_black, starts_with('pop_')), 'dd_interaction')
Compute Distance Decay Isolation
ds_dd_isolation(.data, .cols, .name, .comp = FALSE) dd_isolation(..., .data = dplyr::across(everything()))
ds_dd_isolation(.data, .cols, .name, .comp = FALSE) dd_isolation(..., .data = dplyr::across(everything()))
.data |
tibble with sf geometry |
.cols |
|
.name |
name for column with distance decay isolation. Leave missing to return a vector. |
.comp |
Default is FALSE. FALSE returns the sum, TRUE returns the components. |
... |
arguments to forward to ds_dd_isolation from dd_isolation |
a tibble or numeric vector if .name missing
data('de_county') ds_dd_isolation(de_county, c(pop_black, starts_with('pop_'))) ds_dd_isolation(de_county, c(pop_black, starts_with('pop_')), 'dd_isolation')
data('de_county') ds_dd_isolation(de_county, c(pop_black, starts_with('pop_'))) ds_dd_isolation(de_county, c(pop_black, starts_with('pop_')), 'dd_isolation')
Compute Delta Index
ds_delta(.data, .cols, .name, .comp = FALSE) delta(..., .data = dplyr::across(everything()))
ds_delta(.data, .cols, .name, .comp = FALSE) delta(..., .data = dplyr::across(everything()))
.data |
tibble with sf geometry |
.cols |
|
.name |
name for column with delta index. Leave missing to return a vector. |
.comp |
Default is FALSE. FALSE returns the sum, TRUE returns the components. |
... |
arguments to forward to ds_delta from delta |
a tibble or numeric vector if .name missing
data('de_county') ds_delta(de_county, c(pop_white, starts_with('pop_'))) ds_delta(de_county, starts_with('pop_'), 'delta')
data('de_county') ds_delta(de_county, c(pop_white, starts_with('pop_'))) ds_delta(de_county, starts_with('pop_'), 'delta')
Compute Dissimilarity Index
ds_dissim(.data, .cols, .name, .comp = FALSE) dissim(..., .data = dplyr::across(everything()))
ds_dissim(.data, .cols, .name, .comp = FALSE) dissim(..., .data = dplyr::across(everything()))
.data |
|
.cols |
|
.name |
name for column with dissimilarity index. Leave missing to return a vector. |
.comp |
Default is FALSE. FALSE returns the sum, TRUE returns the components. |
... |
arguments to forward to ds_dissim from dissim |
a tibble or numeric vector if .name missing
data('de_county') ds_dissim(de_county, c(pop_white, starts_with('pop_'))) ds_dissim(de_county, c(pop_white, starts_with('pop_')), .comp = TRUE) ds_dissim(de_county, starts_with('pop_'), 'dissim')
data('de_county') ds_dissim(de_county, c(pop_white, starts_with('pop_'))) ds_dissim(de_county, c(pop_white, starts_with('pop_')), .comp = TRUE) ds_dissim(de_county, starts_with('pop_'), 'dissim')
This is equivalent to perplexity.
ds_diversity(.data, .cols, .name, q = 1) diversity(..., .data = dplyr::across(everything())) ds_perplexity(.data, .cols, .name, q = 1) perplexity(..., .data = dplyr::across(everything()))
ds_diversity(.data, .cols, .name, q = 1) diversity(..., .data = dplyr::across(everything())) ds_perplexity(.data, .cols, .name, q = 1) perplexity(..., .data = dplyr::across(everything()))
.data |
|
.cols |
|
.name |
name for column with diversity. Leave missing to return a vector. |
q |
exponent parameter. Default 0. Can not be 1. |
... |
arguments to forward to ds_diversity from diversity |
a tibble or numeric vector if .name missing
data('de_county') ds_diversity(de_county, starts_with('pop_')) ds_diversity(de_county, starts_with('pop_'), 'diversity')
data('de_county') ds_diversity(de_county, starts_with('pop_')) ds_diversity(de_county, starts_with('pop_'), 'diversity')
Compute Entropy Index
ds_entropy(.data, .cols, .name, .comp = FALSE) entropy(..., .data = dplyr::across(everything()))
ds_entropy(.data, .cols, .name, .comp = FALSE) entropy(..., .data = dplyr::across(everything()))
.data |
|
.cols |
|
.name |
name for column with entropy index. Leave missing to return a vector. |
.comp |
Default is FALSE. FALSE returns the sum, TRUE returns the components. |
... |
arguments to forward to ds_entropy from entropy |
a tibble or numeric vector if .name missing
data('de_county') ds_entropy(de_county, c(pop_white, starts_with('pop_'))) ds_entropy(de_county, starts_with('pop_'), 'entropy')
data('de_county') ds_entropy(de_county, c(pop_white, starts_with('pop_'))) ds_entropy(de_county, starts_with('pop_'), 'entropy')
Compute Gini Index
ds_gini(.data, .cols, .name, .comp = FALSE) gini(..., .data = dplyr::across(everything()))
ds_gini(.data, .cols, .name, .comp = FALSE) gini(..., .data = dplyr::across(everything()))
.data |
|
.cols |
|
.name |
name for column with gini index. Leave missing to return a vector. |
.comp |
Default is FALSE. FALSE returns the sum, TRUE returns the components. |
... |
arguments to forward to ds_gini from gini |
a tibble or numeric vector if .name missing
data('de_county') ds_gini(de_county, c(pop_white, starts_with('pop_'))) ds_gini(de_county, starts_with('pop_'), 'gini')
data('de_county') ds_gini(de_county, c(pop_white, starts_with('pop_'))) ds_gini(de_county, starts_with('pop_'), 'gini')
This is equivalent to the Simpson Index.
ds_hhi(.data, .cols, .name) hhi(..., .data = dplyr::across(everything())) ds_simpson(.data, .cols, .name) simpson(..., .data = dplyr::across(everything()))
ds_hhi(.data, .cols, .name) hhi(..., .data = dplyr::across(everything())) ds_simpson(.data, .cols, .name) simpson(..., .data = dplyr::across(everything()))
.data |
|
.cols |
|
.name |
name for column with HHI. Leave missing to return a vector. |
... |
arguments to forward to ds_hhi from hhi |
a tibble or numeric vector if .name missing
data('de_county') ds_hhi(de_county, starts_with('pop_')) ds_hhi(de_county, starts_with('pop_'), 'blau')
data('de_county') ds_hhi(de_county, starts_with('pop_')) ds_hhi(de_county, starts_with('pop_'), 'blau')
Compute Interaction Index
ds_interaction(.data, .cols, .name, .comp = FALSE) interaction(..., .data = dplyr::across(everything()))
ds_interaction(.data, .cols, .name, .comp = FALSE) interaction(..., .data = dplyr::across(everything()))
.data |
|
.cols |
|
.name |
name for column with Interaction index. Leave missing to return a vector. |
.comp |
Default is FALSE. FALSE returns the sum, TRUE returns the components. |
... |
arguments to forward to ds_interaction from interaction |
a tibble or numeric vector if .name missing
data('de_county') ds_interaction(de_county, c(pop_white, starts_with('pop_'))) ds_interaction(de_county, starts_with('pop_'), 'interaction')
data('de_county') ds_interaction(de_county, c(pop_white, starts_with('pop_'))) ds_interaction(de_county, starts_with('pop_'), 'interaction')
Compute Simpson Index
ds_inv_simpson(.data, .cols, .name) inv_simpson(..., .data = dplyr::across(everything()))
ds_inv_simpson(.data, .cols, .name) inv_simpson(..., .data = dplyr::across(everything()))
.data |
|
.cols |
|
.name |
name for column with Simpson Index Leave missing to return a vector. |
... |
arguments to forward to ds_inv_simpson from inv_simpson |
a tibble or numeric vector if .name missing
data('de_county') ds_inv_simpson(de_county, starts_with('pop_')) ds_inv_simpson(de_county, starts_with('pop_'), 'blau')
data('de_county') ds_inv_simpson(de_county, starts_with('pop_')) ds_inv_simpson(de_county, starts_with('pop_'), 'blau')
Compute Isolation Index
ds_isolation(.data, .cols, .name, .comp = FALSE) isolation(..., .data = dplyr::across(everything()))
ds_isolation(.data, .cols, .name, .comp = FALSE) isolation(..., .data = dplyr::across(everything()))
.data |
|
.cols |
|
.name |
name for column with Isolation index. Leave missing to return a vector. |
.comp |
Default is FALSE. FALSE returns the sum, TRUE returns the components. |
... |
arguments to forward to ds_isolation from isolation |
a tibble or numeric vector if .name missing
data('de_county') ds_isolation(de_county, c(pop_white, starts_with('pop_'))) ds_isolation(de_county, starts_with('pop_'), 'isolation')
data('de_county') ds_isolation(de_county, c(pop_white, starts_with('pop_'))) ds_isolation(de_county, starts_with('pop_'), 'isolation')
Compute Relative Centralization
ds_rel_cent(.data, .cols, .name) rel_cent(..., .data = dplyr::across(everything()))
ds_rel_cent(.data, .cols, .name) rel_cent(..., .data = dplyr::across(everything()))
.data |
tibble with sf geometry |
.cols |
|
.name |
name for column with relative centralization. Leave missing to return a vector. |
... |
arguments to forward to ds_rel_cent from rel_cent |
a tibble or numeric vector if .name missing
data('de_county') ds_rel_cent(de_county, c(pop_white, starts_with('pop_'))) ds_rel_cent(de_county, c(pop_white, starts_with('pop_')), 'rel_cent')
data('de_county') ds_rel_cent(de_county, c(pop_white, starts_with('pop_'))) ds_rel_cent(de_county, c(pop_white, starts_with('pop_')), 'rel_cent')
Compute Relative Clustering
ds_rel_clust(.data, .cols, .name) rel_clust(..., .data = dplyr::across(everything()))
ds_rel_clust(.data, .cols, .name) rel_clust(..., .data = dplyr::across(everything()))
.data |
tibble with sf geometry |
.cols |
|
.name |
name for column with relative clustering. Leave missing to return a vector. |
... |
arguments to forward to ds_rel_clust from rel_clust |
a tibble or numeric vector if .name missing
data('de_county') ds_rel_clust(de_county, c(pop_black, starts_with('pop_'))) ds_rel_clust(de_county, c(pop_black, starts_with('pop_')), 'rel_clust')
data('de_county') ds_rel_clust(de_county, c(pop_black, starts_with('pop_'))) ds_rel_clust(de_county, c(pop_black, starts_with('pop_')), 'rel_clust')
Compute Relative Concentration
ds_rel_conc(.data, .cols, .name) rel_conc(..., .data = dplyr::across(everything()))
ds_rel_conc(.data, .cols, .name) rel_conc(..., .data = dplyr::across(everything()))
.data |
tibble with sf geometry |
.cols |
|
.name |
name for column with relative concentration. Leave missing to return a vector. |
... |
arguments to forward to ds_rel_conc from rel_conc |
a tibble or numeric vector if .name missing
data('de_county') ds_rel_conc(de_county, c(pop_black, starts_with('pop_'))) ds_rel_conc(de_county, c(pop_black, starts_with('pop_')), 'rel_conc')
data('de_county') ds_rel_conc(de_county, c(pop_black, starts_with('pop_'))) ds_rel_conc(de_county, c(pop_black, starts_with('pop_')), 'rel_conc')
Compute Reyni Entropy
ds_reyni(.data, .cols, .name, q = 0) reyni(..., .data = dplyr::across(everything()))
ds_reyni(.data, .cols, .name, q = 0) reyni(..., .data = dplyr::across(everything()))
.data |
|
.cols |
|
.name |
name for column with Reyni entropy. Leave missing to return a vector. |
q |
exponent parameter. Default 0. Can not be 1. |
... |
arguments to forward to ds_reyni from reyni |
a tibble or numeric vector if .name missing
data('de_county') ds_reyni(de_county, starts_with('pop_')) ds_reyni(de_county, starts_with('pop_'), 'reyni')
data('de_county') ds_reyni(de_county, starts_with('pop_')) ds_reyni(de_county, starts_with('pop_'), 'reyni')
Compute Shannon Index
ds_shannon(.data, .cols, .name) shannon(..., .data = dplyr::across(everything()))
ds_shannon(.data, .cols, .name) shannon(..., .data = dplyr::across(everything()))
.data |
|
.cols |
|
.name |
name for column with Shannon index. Leave missing to return a vector. |
... |
arguments to forward to ds_shannon from shannon |
a tibble or numeric vector if .name missing
data('de_county') ds_shannon(de_county, starts_with('pop_')) ds_shannon(de_county, starts_with('pop_'), 'shannon')
data('de_county') ds_shannon(de_county, starts_with('pop_')) ds_shannon(de_county, starts_with('pop_'), 'shannon')
Compute Spatial Proximity
ds_spat_prox(.data, .cols, .name) spat_prox(..., .data = dplyr::across(everything()))
ds_spat_prox(.data, .cols, .name) spat_prox(..., .data = dplyr::across(everything()))
.data |
tibble with sf geometry |
.cols |
|
.name |
name for column with spatial proximity. Leave missing to return a vector. |
... |
arguments to forward to ds_spat_prox from spat_prox |
a tibble or numeric vector if .name missing
data('de_county') ds_spat_prox(de_county, c(pop_black, starts_with('pop_'))) ds_spat_prox(de_county, c(pop_black, starts_with('pop_')), 'spat_prox')
data('de_county') ds_spat_prox(de_county, c(pop_black, starts_with('pop_'))) ds_spat_prox(de_county, c(pop_black, starts_with('pop_')), 'spat_prox')