Learn R Programming

ags (version 1.0.1)

ags_dist: Defines a distance metric for the AGS

Description

Defines a distance metric for the AGS

Usage

ags_dist(x, y, landw = 10^6, kreisw = 10^3, gemw = 1, ceiling = 99999999)

Value

A numerical vector.

Arguments

x, y

vectors of AGS values

landw

weight of the Bundesland (Land) integers

kreisw

weight of the Kreis (district) integers

gemw

weight of the Gemeinde (municipality) integers

ceiling

truncate all distances at this value

Details

The distance metric is defined as

abs(x[1:2]- y[1:2])*landw + abs(x[3:5]- y[3:5])*kreisw + abs(x[6:8]- y[6:8])*gemw,

where z[a:b] means all digits between a and b for integer z.

With the default weights, this sum is the absolute difference between x and y.

Examples

Run this code
ags_dist(14053,14059)

Run the code above in your browser using DataLab