View source: R/voter_distance.R
| haversine | R Documentation |
Compute the Haversine (great-circle) distance between a single pair of lat/lon coordinates.
haversine(lat1, lon1, lat2, lon2, units = c("meters", "km", "miles"))
lat1 |
Latitude of point 1 (degrees). |
lon1 |
Longitude of point 1 (degrees). |
lat2 |
Latitude of point 2 (degrees). |
lon2 |
Longitude of point 2 (degrees). |
units |
One of |
Numeric scalar distance in the specified units.
# New York to London
haversine(40.7128, -74.0060, 51.5074, -0.1278, units = "km")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.