How to use distHaversine function?

Viewed 8192

I am trying to use the distHavrsine function in R, inside a loop to calculate the distance between some latitude and longitude coordinates for a several hundred rows. In my loop I have this code:

if ((distHaversine(c(file[i,"long"], file[i,"lat"]),
                   c(file[j,"long"], file[j,"lat"]))) < 50 )

after which if the distance is less than 50 meters i want it to record those rows, and where the latitude and longitude coordinates it is referencing look like:

0.492399367 30.42530045

and

0.496899361 30.42497045

but i get this error

Error in .pointsToMatrix(p1) : latitude > 90

1 Answers
Related