i have a data frame with more than 10 million rows. I want to count the distance between the lat-lon pairs, and add them to a nem column. I have tried to run the script(see below) , but it takes too long(more than 5 hours). Any tip how can i boost the speed of this process? I use the geosphere package to count distance between the lat-lon pairs.
for (i in seq_len(nrow(dm_kekk)))
{
dm_kekk$dist[i]<-distm (c(dm_kekk$lon[i], dm_kekk$lat[i]),
c(dm_kekk$lon_ok[i], dm_kekk$lat_ok[i]),
fun = distHaversine)
}
Thanks!!!