combine.data.shapefile: Combines a data frame with a shapefile to create a...

Description Usage Arguments Value Author(s) Examples

View source: R/combine.data.shapefile.R

Description

This function combines a data frame with a shapefile to create a SpatialPolygonsDataFrame object from the ‘sp’ package. The creation of this object allows the variables in the data frame to be mapped using the ‘spplot()’ function, and the neighbourhood matrix W to be created using the ‘poly2nb’ and ‘nb2mat’ functions. An example is given in the vignette accompanying this package. The mapping of the data to the shapefile is done by matching the rownames of the data frame to the first column in the dbf file.

Usage

1

Arguments

data

A data frame containing the variables relating to the K areas you wish to map or model. The row names of this data frame must appear in the first column of the dbf file.

shp

The .shp part of a shapefile containing the polygons for each of the K areas that the data relate to.

dbf

The .dbf part of the shapefile containing a lookup table whose first column should inlcude the K row names of the data frame.

Value

A SpatialPolygonsDataFrame object from the sp package containing the conbined data and shapefile object.

Author(s)

Duncan Lee

Examples

1
## See the vignette accompanying this package for an example of its use.

Example output

Loading required package: MASS
Loading required package: Rcpp

CARBayes documentation built on May 31, 2021, 9:07 a.m.