Learn R Programming

Rvoterdistance (version 1.1)

distanceEarth: Calculate the distance between two points

Description

Calculates the distance between two points on Earth, in Haversines

Usage

distanceEarth(lat1d, lon1d, lat2d, lon2d)

Arguments

lat1d
Numeric/Double, Latitude coordinate of point 1
lon1d
Numeric/Double, Longitude coordinate of point 1
lat2d
Numeric/Double, Latitude coordinate of point 2
lon2d
Numeric/Double, Longitude coordinate of point 2

Value

Haversine distance output, in meters

References

Haversine: CC Robusto, 1957

Examples

Run this code
data(king_dbox)
# Calculate distance between two points
distanceEarth(king_geo$Residence_Addresses_Latitude[1], 
king_geo$Residence_Addresses_Longitude[1], 
dbox$lat[1], dbox$long[1])

Run the code above in your browser using DataLab