Defines a distance metric for the AGS
ags_dist(x, y, landw = 10^6, kreisw = 10^3, gemw = 1, ceiling = 99999999)
vectors of AGS values
weight of the Bundesland (Land) integers
weight of the Kreis (district) integers
weight of the Gemeinde (municipality) integers
truncate all distances at this value
A numerical vector.
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.
ags_dist(14053,14059)
#> [1] 6