shape.H | R Documentation |
Takes a path to a shape file and creates a neighborhood matrix. This neighborhood matrix can be used with the objective ICAR model \insertCiteKeefe_2018ref.ICAR.
shape.H(shape.file)
shape.file |
File path to a shapefile. |
A list containing a neighborhood matrix and the SpatialPolygonsDataFrame object corresponding to the shape file.
H |
A neighborhood matrix. |
map |
SpatialPolygonsDataFrame object from the provided shapefile. |
Erica M. Porter, Matthew J. Keefe, Christopher T. Franck, and Marco A.R. Ferreira
#### Load extra libraries
library(sp)
library(sf)
### Read in a shapefile of the contiguous U.S. from package data
system.path <- system.file("extdata", "us.shape48.shp", package = "ref.ICAR", mustWork = TRUE)
shp.layer <- gsub('.shp','',basename(system.path))
shp.path <- dirname(system.path)
us.shape48 <- st_read(dsn = path.expand(shp.path), layer = shp.layer)
shp.data <- shape.H(system.path)
names(shp.data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.