Spatial weights matrix class / constructor

wmat(w, geom, type = NULL, coords = NULL)

Arguments

w

a matrix

geom

geometry from which the matrix was constructed. Used for plotting.

type

String describing the weights matrix type

coords

Alternative coordinates to use when plotting, otherwise will default to centroids.

Examples

library("sf") data("est_adm1") w <- w_contiguity(sf::st_geometry(est_adm1)) w
#> Spatial weights matrix [15 x 15] #> Type: Contiguity (rook)
plot(w)
# the vertices default to centroid coordinates; this can be changed by # setting alternative coordinates coords <- st_as_sf(as.data.frame(est_adm1), coords = c("caplong", "caplat"), remove = TRUE, crs = 4326) coords <- st_geometry(coords) w <- set_coords(w, coords) plot(w)