This should do what you want.
Be careful, in the order of the points in your SpatialPointsDataFrame is
important !
d<-spDists(xy) <= 0.2
d[upper.tri(d, diag=T)] <-NA
select<-xy[-which(apply(d, 1,function(x) any(x == TRUE))),]
plot(select)
Arnaud
> # I have a SpatialPointsDataFrame that contains
Hello,
I looked at your problem and I can't understand it. What are your trying to
do? It's not clear. Are you trying to find the points that are at less than
200m from ALL other points? Or at 200m of AT LEAST one other point? You have
a distance matrix here, which is n*n, you can difficul
Try the function zerodist or remove.duplicates in sp, with zero set to 0.2
Cheers,
Tim
>>>>>>>>>>>
Date: Fri, 26 Apr 2013 15:10:57 +0100
From: Ross Ahmed
To:
Subject: [R-sig-Geo] remove points less than certain distance
Message-ID:
Con
# I have a SpatialPointsDataFrame that contains points, some of which are
<=200m from each other, some of which points are >200m from each other.
x <- c(-1.344, -1.345, -1.346, -1.346,-1.347, -1.328, -1.329, -1.33)
y <- c(rep(54.76558, 3), 54.7610, 54.7611, rep(54.75167, 3))
xy <- data.frame(x,y, v