get_neighbors: Get neighbors for idx-th observation based on weights matrix

Description Usage Arguments Value Examples

View source: R/weights.R

Description

Get neighbors for idx-th observation, idx starts from 1

Usage

1
get_neighbors(gda_w, idx)

Arguments

gda_w

A Weight object

idx

A value indicates idx-th observation, idx start from 1

Value

Vector of the neighbor indices, idx start from 1

Examples

1
2
3
4
5
6
7
8
## Not run: 
guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda")
guerry <- geoda_open(guerry_path)
queen_w <- queen_weights(guerry)
nbrs <- get_neighbors(queen_w, idx = 1)
cat("\nNeighbors of the 1-st observation are:", nbrs)

## End(Not run)

lixun910/rgeoda documentation built on March 19, 2021, 3:49 p.m.