View source: R/computeSpatialWeights.R
| computeSpatialWeights | R Documentation |
Builds queen (nearby) and distance-decay (diffuse) spatial weight matrices
from a bin-level sf object, excluding bins that have no neighbours.
computeSpatialWeights(bins, bin_size = 50, dmax = 250)
bins |
An |
bin_size |
Numeric. Bin spacing used to define queen adjacency
( |
dmax |
Numeric. Maximum distance for diffuse-mode neighbours. |
A list with:
Spatial weights list for nearby (queen) mode.
Spatial weights list for diffuse (distance-decay) mode.
Integer indices of bins used in queen-mode Moran.
Integer indices of bins used in diffuse-mode Moran.
Integer indices of original queen-mode isolates.
Integer indices of original diffuse-mode isolates.
Full (unsubset) neighbour list for nearby mode, indexed over all bins.
Full (unsubset) neighbour list for diffuse mode, indexed over all bins.
## Not run:
set.seed(42)
pts <- sf::st_as_sf(
data.frame(x = runif(300, 0, 1000), y = runif(300, 0, 1000)),
coords = c("x", "y"), crs = NA
)
bins <- sf::st_sf(
geometry = sf::st_make_grid(pts, cellsize = 100,
what = "polygons", square = FALSE)
)
sw <- computeSpatialWeights(bins, bin_size = 100, dmax = 300)
names(sw)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.