ng_distance: Distance between two Nigerian state capitals

View source: R/distances.R

ng_distanceR Documentation

Distance between two Nigerian state capitals

Description

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.

Usage

ng_distance(a, b, unit = c("km", "miles"))

Arguments

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".

Details

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.

Value

Numeric vector of road distances in the requested unit (rounded to 1 decimal place), with the same length as a and b.

Examples

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


naijR documentation built on March 14, 2026, 1:06 a.m.