View source: R/weights-inverse-distance.R
st_inverse_distance | R Documentation |
From a neighbor list and sf geometry column, calculate inverse distance weight.
st_inverse_distance(nb, geometry, scale = 100, alpha = 1)
nb |
a neighbors list object e.g. created by |
geometry |
sf geometry |
scale |
default |
alpha |
default 1. Set to 2 for gravity weights. |
The inverse distance formula is
w_{ij} = 1 / d_{ij}^\alpha
a list where each element is a numeric vector
Other weights:
st_kernel_weights()
,
st_nb_dists()
,
st_weights()
geo <- sf::st_geometry(guerry)
nb <- st_contiguity(geo)
wts <- st_inverse_distance(nb, geo)
head(wts, 3)
wts <- st_inverse_distance(nb, geo, scale = 10000)
head(wts, 3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.