library(sf)
# data with 10 duplicate obs
s <- data.frame(x = runif(100), y = runif(100))
s <- data.frame(rbind(s, s[sample(1:nrow(s), 10),]) )
s <- st_as_sf(s, coords = c("x", "y"))
s$ID <- 1:nrow(s)
nrow(s)
nrow( srmd <- remove_duplicates(s) )
Run the code above in your browser using DataLab