st_lag | R Documentation |
Calculates the spatial lag of a numeric variable given a neighbor and weights list.
st_lag(x, nb, wt, na_ok = FALSE, allow_zero = NULL, ...)
x |
A numeric vector |
nb |
A neighbor list object as created by |
wt |
A weights list as created by |
na_ok |
Default |
allow_zero |
If |
... |
See |
a numeric vector with same length as x
Other stats:
local_moran()
geo <- sf::st_geometry(guerry)
nb <- st_contiguity(geo)
wt <- st_weights(nb)
st_lag(guerry$crime_pers, nb, wt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.