Networknb {spnaf}R Documentation

Calculate spatial weights for networks based on input polygons.

Description

Calculate spatial weights for networks based on input polygons.

Usage

Networknb(shape, snap = 1, queen = TRUE, method = "t")

Arguments

shape

A shapefile (in a polygon type) that matches to your OD dataframe. The shape must have an "id" column to match your ids in df.

snap

A parameter that is also used to calculate spdep's spatial contingency (Please view documents of poly2nb for more information).

queen

A TRUE/FALSE input that is used to calculate spdep's spatial contingency (Please view documents of poly2nb for more information).

method

A string value among "o" (origin based), "d" (destination based), and "t" (both way) which determines the way to generate Spatial Weights. The default value is "t".

Value

The result is in the form of a list which includes combinations of origin ids and destination ids.

Examples

# Data manipulation
# Load sf polygon

CA_polygon <- spnaf::CA_polygon

# Execution of Networknb with data above and given parameters

nnb <- Networknb(shape = CA_polygon, queen = TRUE, snap = 1, method = 'o')


# check the results

head(nnb)


[Package spnaf version 1.1.0 Index]