listw2sn: Spatial neighbour sparse representation

Description Usage Arguments Value Author(s) See Also Examples

View source: R/listw2sn.R

Description

The function makes a "spatial neighbour" object representation (similar to the S-PLUS spatial statististics module representation of a "listw" spatial weights object. sn2listw() is the inverse function to listw2sn(), creating a "listw" object from a "spatial neighbour" object.

Usage

1
2
listw2sn(listw)
sn2listw(sn)

Arguments

listw

a listw object from for example nb2listw

sn

a spatial.neighbour object

Value

listw2sn()returns a data frame with three columns, and with class spatial.neighbour:

from

region number id for the start of the link (S-PLUS row.id)

to

region number id for the end of the link (S-PLUS col.id)

weights

weight for this link

Author(s)

Roger Bivand Roger.Bivand@nhh.no

See Also

nb2listw

Examples

1
2
3
4
5
6
7
columbus <- st_read(system.file("shapes/columbus.shp", package="spData")[1], quiet=TRUE)
col.gal.nb <- read.gal(system.file("weights/columbus.gal", package="spData")[1])
col.listw <- nb2listw(col.gal.nb)
col.listw$neighbours[[1]]
col.listw$weights[[1]]
col.sn <- listw2sn(col.listw)
str(col.sn)

r-spatial/spdep documentation built on Sept. 14, 2021, 11:48 p.m.