localmoran.map: A function for creating an interactive map of local Moran's I...

View source: R/localmoran.map.R

localmoran.mapR Documentation

A function for creating an interactive map of local Moran's I statistics

Description

This function plots a map with the results of local Moran's I statistics, based on spatial polygons, a 'listw' object, and a variable with an ID.

Usage

localmoran.map(p, listw, VAR, by)

Arguments

p

A simple features 'sf' object

listw

A listw object (see spdep)

VAR

A character string with the name of a variable

by

A character string with the name of a key to join the local Moran's I statistics to the 'sf' object

Examples

# Create a map of local Moran's I statistics for population density
#
# Obtain a listw object for the contiguities. First obtain the neighbors:
Hamilton_CT.nb <- spdep::poly2nb(as(Hamilton_CT, "Spatial"))
# Based on the neighbors, obtain a listw object:
Hamilton_CT.w <- spdep::nb2listw(Hamilton_CT.nb)

localmoran.map(Hamilton_CT, Hamilton_CT.w, "POP_DENSITY", "TRACT")

paezha/geog4ga3 documentation built on Nov. 20, 2024, 2:18 a.m.