Hi I have a dataset and I am trying to get a group cluster id based on the 50 mile radius. Here is the structure of the dataset
g_lat<- c(45.52306, 40.26719, 34.05223, 37.38605, 37.77493)
g_long<- c(-122.67648,-86.13490, -118.24368, -122.08385, -122.41942)
df<- data.frame(g_lat, g_long)
I want to create a group cluster id which is basically going to group locations that are within 50 mile radius. Let me know how I can achieve this? Thanks so much. Below is the expected output.
g_lat g_long clusterid
45.52306 -122.67648 1
40.26719 -86.13490 2
34.05223 -118.24368 3
37.38605 -122.08385 4
37.77493 -122.41942 4