| haversine | R Documentation |
Vectorized great-circle distance between longitude/latitude points. Arguments are recycled to a common length, so any may be length 1.
haversine(lon1, lat1, lon2, lat2, radius = 6371.0088)
lon1, lat1, lon2, lat2 |
Numeric vectors of coordinates in decimal degrees. |
radius |
Sphere radius in the desired output units. Defaults to the mean Earth
radius, |
A numeric vector of distances. NA in any coordinate gives NA.
haversine(0, 0, 0, 1) # ~111 km per degree of latitude
haversine(7.4, 9.1, 8.5, 12.0) # Abuja-ish to Kano-ish
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.