I want to create an unique ID in R based on two columns of latitude and longitude so that duplicated locations have the same cluster ID.
For example:
LAT LONG Cluster_ID
13.5330 -15.4180 1
13.5330 -15.4180 1
13.5330 -15.4180 1
13.5330 -15.4180 1
13.5330 -15.4170 2
13.5330 -15.4170 2
13.5330 -15.4170 2
13.5340 -14.9350 3
13.5340 -14.9350 3
13.5340 -15.9170 4
13.3670 -14.6190 5
Here’s one way using
interaction.EDIT: Incorporated @Spacedman’s suggestion to supply
drop=TRUEtointeraction.