quantify_raceland {raceland} | R Documentation |
Quantify a racial landscape
Description
This function is a wrapper of several steps (functions) implemented in the raceland package: create_realizations()
, create_densities()
, calculate_metrics()
, and create_grid()
.
Usage
quantify_raceland(
x,
n,
window_size,
neighbourhood = 4,
fun,
size = NULL,
na_action = "replace",
base = "log2",
ordered = TRUE,
threshold = 0.5
)
Arguments
x |
SpatRaster with race-specific population densities assign to each cell |
n |
A number of realizations |
window_size |
Size, expressed in the number of cells, of a square-shaped local window for which local densities will be calculated; it is recommended to use the small window_size, i.e., 10 |
neighbourhood |
The number of directions in which cell adjacencies are considered as neighbours: |
fun |
Function to calculate values from adjacent cells to contribute to exposure matrix, |
size |
Expressed in the numbers of cells, is a length of the side of a square-shaped block of cells. It defines the extent of a local pattern. If |
na_action |
Decides on how to behave in the presence of missing values in |
base |
The unit in which entropy is measured. The default is "log2", which compute entropy in "bits". |
ordered |
The type of pairs considered. Either ordered ( |
threshold |
The share of NA cells to allow metrics calculation in a square-shaped window |
Value
An sf polygon object with five columns - row
and col
allowing for identification of each square polygon, ent
- entropy measuring racial diversity, mutinf
- mutual information, which is associated with measuring racial segregation, and geometry
containing spatial geometries.
Examples
library(terra)
race_raster = rast(system.file("extdata/race_raster.tif", package = "raceland"))
rl = quantify_raceland(race_raster, n = 10, window_size = 10,
neighbourhood = 4, fun = "mean", size = 20)