sp
How to efficiently calculate distance between pair of coordinates using data.table :=
I wrote my own version of geosphere::distHaversine so that it would more naturally fit into a data.table := call, and it might be of use here dt.haversine <- function(lat_from, lon_from, lat_to, lon_to, r = 6378137){ radians <- pi/180 lat_to <- lat_to * radians lat_from <- lat_from * radians lon_to <- lon_to * radians lon_from <- … Read more