Learn R Programming

spnaf (version 1.1.0)

Networknb: 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")

Value

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

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".

Examples

Run this code
# Data manipulation
# Load sf polygon
# \donttest{
CA_polygon <- spnaf::CA_polygon
# }
# Execution of Networknb with data above and given parameters
# \donttest{
nnb <- Networknb(shape = CA_polygon, queen = TRUE, snap = 1, method = 'o')
# }

# check the results
# \donttest{
head(nnb)
# }

Run the code above in your browser using DataLab