wmat: Spatial weights matrix

Description Usage Arguments Examples

View source: R/wmat.R

Description

Spatial weights matrix class / constructor

Usage

1
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

 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)

andybega/wstates documentation built on Nov. 2, 2019, 1:53 p.m.