Learn R Programming

spatialEco (version 2.0-1)

remove_duplicates: Remove duplicate geometries

Description

Removes duplicate geometries in a single-part feature class

Usage

remove_duplicates(x, threshold = 0.00001)

Value

sf object, of same feature class as x, with duplicate geometries removed

Arguments

x

An sf POINT, POLYGON or LINESTRING object

threshold

A distance threshold indicating fuzzy duplication, default i 0.00001

Author

Jeffrey S. Evans <jeffrey_evans@tnc.org>

Examples

Run this code
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