| ng_distance | R Documentation |
Retrieves the precomputed road (driving) distance between Nigerian
state capitals. Both a and b can be vectors of the same
length, in which case distances are computed element-wise.
ng_distance(a, b, unit = c("km", "miles"))
a, b |
Character vector. Name(s) of city/cities (case-insensitive). Must be the same length; vector recycling is not permitted. |
unit |
Character. Unit of distance to return. One of "km" (default) or "miles". |
Distances are approximate driving distances sourced from travel allowance guidance provided by UNDP Nigeria. They represent typical road travel and may vary due to route choice, road conditions, or detours.
Numeric vector of road distances in the requested unit (rounded to
1 decimal place), with the same length as a and b.
ng_distance("Lagos", "Kano")
ng_distance("Abuja", "Port Harcourt", unit = "miles")
ng_distance("Ibadan", "enugu") # case-insensitive
ng_distance(c("Lagos", "Abuja"), c("Kano", "Enugu")) # vectorized
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.