Learn R Programming

gdverse (version 1.1.0)

inverse_distance_weight: calculate inverse distance weight

Description

Function for calculate inverse distance weight.

Usage

inverse_distance_weight(locx, locy, power = 1, is_arc = FALSE)

Value

A inverse distance weight matrices with class of matrix.

Arguments

locx

The x axis location.

locy

The y axis location.

power

(optional) Default is 1. Set to 2 for gravity weights.

is_arc

(optional) FALSE (default) or TRUE, whether to compute arc distance.

Details

The inverse distance weight formula is \(w_{ij} = 1 / d_{ij}^\alpha\)

Examples

Run this code
x = 1:10
y = 1:10
inverse_distance_weight(x,y)
inverse_distance_weight(x,y,is_arc = TRUE)

Run the code above in your browser using DataLab