Description Usage Arguments Examples
Spatial weights matrix class / constructor
1 |
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. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | library("sf")
data("est_adm1")
w <- w_contiguity(sf::st_geometry(est_adm1))
w
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.