Learn R Programming

SDPDmod (version 0.0.6)

mOrdNbr: 1st to m-th order neighbors matrix

Description

Finds the 1th to m-th order neighbors matrix.

Usage

mOrdNbr(sf_pol = NULL, m = 1, neigbs = NULL, listv = FALSE, rn = FALSE)

Value

W

spatial weights matrix

nlist

list of neighbors

Arguments

sf_pol

spatial polygons object

m

the order of neighbors up to which they will be included in the weights matrix, default 1

neigbs

neighbors list, default NULL

listv

logical, default FALSE. If TRUE the list of neighbors should also be returned

rn

logical, default FALSE. If TRUE, the weight matrix will be row-normalized

Author

Rozeta Simonovska

Examples

Run this code
library("sf")
ger   <- st_read(system.file("shape/GermanyNUTS3.shp",
                             package = "SDPDmod"),
                 quiet = TRUE)
m1thn <- mOrdNbr(ger)
# \donttest{
m4thn <- mOrdNbr(ger, 4)
mat1  <- rownor(m4thn)
m4thn2<- mOrdNbr(ger, 4, listv = TRUE, rn = TRUE)
mat2  <- m4thn2$W
# }

Run the code above in your browser using DataLab