[R] Sampling the Distance Matrix
Lorenzo Isella
lorenzo.isella at gmail.com
Wed Sep 23 21:15:37 CEST 2015
Dear All,
Suppose you have a distance matrix stored like a dist object, for
instance
x<-rnorm(20)
y<-rnorm(20)
mm<-as.matrix(cbind(x,y))
dst<-(dist(mm))
Now, my problem is the following: I would like to get the rows of mm
corresponding to points whose distance is always larger of, let's say,
0.9.
In other words, if I were to compute the distance matrix on those
selected rows of mm, apart from the diagonal, I would get all entries
larger than 0.9.
Any idea about how I can efficiently code that?
Regards
Lorenzo
More information about the R-help
mailing list