shape.H {ref.ICAR}R Documentation

Creating a Neighborhood Matrix for Areal Data from a Shapefile

Description

Takes a path to a shape file and creates a neighborhood matrix. This neighborhood matrix can be used with the objective ICAR model (Keefe et al. 2018).

Usage

shape.H(shape.file)

Arguments

shape.file

File path to a shapefile.

Value

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.

Author(s)

Erica M. Porter, Matthew J. Keefe, Christopher T. Franck, and Marco A.R. Ferreira

Examples

#### 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)

[Package ref.ICAR version 2.0.1 Index]