include.self: Include self in neighbours list

View source: R/weights-utils.R

include.selfR Documentation

Include self in neighbours list

Description

The function includes the region itself in its own list of neighbours, and sets attribute "self.included" to TRUE; remove.self reverts the effects of include.self.

Usage

include.self(nb)
remove.self(nb)

Arguments

nb

input neighbours list of class nb

Value

The function returns an object of class nb with a list of integer vectors containing neighbour region number ids; attribute "self.included" is set to TRUE.

Author(s)

Roger Bivand Roger.Bivand@nhh.no

See Also

summary.nb

Examples

columbus <- st_read(system.file("shapes/columbus.gpkg", package="spData")[1], quiet=TRUE)
col.gal.nb <- read.gal(system.file("weights/columbus.gal", package="spData")[1])
coords <- st_coordinates(st_centroid(columbus))
summary(col.gal.nb, coords)
summary(include.self(col.gal.nb), coords)
summary(remove.self(include.self(col.gal.nb)), coords)

r-spatial/spdep documentation built on Dec. 27, 2024, 6:11 a.m.