View source: R/voter_distance.R
| dist_km | R Documentation |
Given lat/lon vectors for voters and locations, returns the minimum Haversine distance in kilometers for each voter to the nearest location.
dist_km(lat1, lon1, lat2, lon2)
lat1 |
Numeric vector of voter latitudes. |
lon1 |
Numeric vector of voter longitudes. |
lat2 |
Numeric vector of location latitudes. |
lon2 |
Numeric vector of location longitudes. |
Numeric vector of minimum distances in kilometers.
data(meck_ev)
d <- dist_km(voter_meck$lat, voter_meck$long,
early_meck$lat, early_meck$long)
summary(d)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.