在 RI 中有一个带有重复点(坐标和属性)的 SpatialPointsDataFrame,我想删除所有具有相同数据的点...
我在sp
包中找到了该remove.duplicates()
功能,但它似乎只在位置上删除......还有其他方法吗?
谢谢你
E.
像这样的东西会起作用吗?
library(sp)
pts <- SpatialPoints(cbind(c(1, 1, 1, 2, 3, 4), c(1, 1, 1, 4, 2, 4)))
pts <- SpatialPointsDataFrame(pts, data=data.frame(id = c(1, 2, 2, 3, 4, 5)))
## All points
pts
## No spatial duplicates
remove.duplicates(pts)
## No duplicates in attributes
pts[which(!duplicated(pts$id)), ]
## Combination
pts[which(!duplicated(as.data.frame(pts))), ]