Learn R Programming

gstat (version 0.9-8)

zerodist: find point pairs with equal spatial coordinates

Description

find point pairs with equal spatial coordinates

Usage

zerodist(x, y, z, zero = 0.0)

Arguments

x
vector with x-coordinate
y
vector with y-coordinate (may be missing)
z
vector with z-coordinate (may be missing)
zero
value to be compared to for establishing when a distance is considered zero (default 0.0)

Value

  • pairs of row numbers with identical coordinates, numeric(0) if no such pairs are found

Examples

Run this code
data(meuse)
# pick 10 rows
n <- 200
ran10 <- sample(nrow(meuse), size = n, replace = TRUE)
meusedup <- rbind(meuse, meuse[ran10, ])
zd <- zerodist(meusedup$x, meusedup$y)
sum(abs(zd[1:n,1] - sort(ran10))) # 0!
# remove the duplicate rows:
meusedup2 <- meusedup[-zd[,2], ]

Run the code above in your browser using DataLab