Grouping similar rows to detect duplicates
I did this when i had duplicate values and multiple other variable which are unique.

adding unique variable to remove duplicates 

"i have added variables as per above data please change as per your requirement"

Df &lt;- DF%>%
  mutate(Path = paste(id,property_type,NEW_BUILD,SURFACE, sep = ">"))

retaining Unique values in the data

Df &lt;-
  distinct(DF,Path, .keep_all= TRUE)