[datatable-help] Select all districts within a 100 km radius of a district

glaporta bioglp at gmail.com
Sat May 13 22:35:14 CEST 2017


Hi, you can add a new distance column and apply a filter to it.
I hope this help,
Gianandrea

coord <- 'your data frame'

library(geosphere)
dist <- vector()
for(i in 1:5){
  dist.tmp <- (distm(coord[1,],coord[i,],fun = distHaversine))
  dist <- c(dist,dist.tmp)
}
coord$dist <- dist
coord[coord$dist>100000,]





--
View this message in context: http://r.789695.n4.nabble.com/Select-all-districts-within-a-100-km-radius-of-a-district-tp4733799p4733801.html
Sent from the datatable-help mailing list archive at Nabble.com.


More information about the datatable-help mailing list