Calculates the great-circle distance between two languages as determined by their WALS latitude-longitude coordinates.
great_circle_distance(id1, id2)
id1 | WALS ID of first language |
---|---|
id2 | WALS ID of second language |
WALS defines the geographical representation of a language as a point in latitude-longitude space. Calculation of great-circle distance is by the haversine formula assuming a perfectly spherical Earth of radius 6,371 km.
a <- great_circle_distance("fre", "ger") b <- great_circle_distance("ger", "rus") c <- great_circle_distance("fre", "rus") if (a + b >= c) { print("The triangle inequality works!") }#> [1] "The triangle inequality works!"