foo <- SpatialPoints(matrix(c(1,2,
2,3,
1,2,
4,5), 4, 2, byrow=TRUE))
multiplicity(foo)
# the following function determines the multiplicities in a matrix
# or data frame and returns unique rows with appended multiplicity
countunique <- function(x) unique(cbind(x, count=multiplicity(x)))
countunique(coordinates(foo))
Run the code above in your browser using DataLab