I am trying to calculate the distance between two points on earth using R.
Store 51.68108210 -0.09732268
Customer 51.66665932 -0.08300349
From reading the
geosphere documentation it looks like you've reversed the argument order.
distGeo in the most recent version of the package, released June 15 2016) expects longitude first, then latitude. You seem to have latitude first.
df <- data.frame(long = c(-0.09732268, -0.08300349), lat = c(51.68108210, 51.66665932)) long lat 1 -0.09732268 51.68108 2 -0.08300349 51.66666 distGeo(df[1, ], df[2, ]) 1885.795 (1.88 km)
You should also check to ensure that you are using the most current version of the package.