Re: [R] Sampling the Distance Matrix

2015-09-25 Thread David Winsemius
On Sep 25, 2015, at 12:54 PM, Lorenzo Isella wrote: > Apologies for not letting this thread rest in peace. > The small script > > # > set.seed(1234) > > x <- rnorm(20) > y <- rnorm(20) > > > goodcls <- apply(mtxcomb , 2, function(idx) al

Re: [R] Sampling the Distance Matrix

2015-09-25 Thread Lorenzo Isella
Apologies for not letting this thread rest in peace. The small script # set.seed(1234) x <- rnorm(20) y <- rnorm(20) goodcls <- apply(mtxcomb , 2, function(idx) all( dist( cbind( x[idx], y[idx]) ) > 0.9)) mycomb <- mtxcomb [ , goodcls] #

Re: [R] Sampling the Distance Matrix

2015-09-25 Thread Lorenzo Isella
Subject: Re: [R] Sampling the Distance Matrix On Sep 24, 2015, at 1:54 PM, Lorenzo Isella wrote: On Thu, Sep 24, 2015 at 01:30:02PM -0700, David Winsemius wrote: On Sep 24, 2015, at 12:36 PM, Lorenzo Isella wrote: Hi, And thanks for your reply. Essentially, your script gets the job done. Fo

Re: [R] Sampling the Distance Matrix

2015-09-25 Thread David L Carlson
-Original Message- From: David Winsemius [mailto:dwinsem...@comcast.net] Sent: Thursday, September 24, 2015 6:30 PM To: Lorenzo Isella Cc: David L Carlson; r-help@r-project.org Subject: Re: [R] Sampling the Distance Matrix On Sep 24, 2015, at 1:54 PM, Lorenzo Isella wrote: > On

Re: [R] Sampling the Distance Matrix

2015-09-24 Thread David Winsemius
On Sep 24, 2015, at 1:54 PM, Lorenzo Isella wrote: > On Thu, Sep 24, 2015 at 01:30:02PM -0700, David Winsemius wrote: >> >> On Sep 24, 2015, at 12:36 PM, Lorenzo Isella wrote: >> >>> Hi, >>> And thanks for your reply. >>> Essentially, your script gets the job done. >>> For instance, if I run >>

Re: [R] Sampling the Distance Matrix

2015-09-24 Thread Lorenzo Isella
On Thu, Sep 24, 2015 at 01:30:02PM -0700, David Winsemius wrote: On Sep 24, 2015, at 12:36 PM, Lorenzo Isella wrote: Hi, And thanks for your reply. Essentially, your script gets the job done. For instance, if I run mm <- cbind(5/(1:5), -2*sqrt(1:5)) dst <- dist(mm) dst2 <- as.matrix(dst) diag

Re: [R] Sampling the Distance Matrix

2015-09-24 Thread David Winsemius
>>13 18 19 >> 13 NA 2.272407 3.606054 >> 18 2.272407 NA 1.578150 >> 19 3.606054 1.578150 NA >> >> - >> David L Carlson >> Department of Anthropology >> Texas A&M Univers

Re: [R] Sampling the Distance Matrix

2015-09-24 Thread Lorenzo Isella
p-boun...@r-project.org] On Behalf Of William Dunlap Sent: Wednesday, September 23, 2015 3:23 PM To: Lorenzo Isella Cc: r-help@r-project.org Subject: Re: [R] Sampling the Distance Matrix mm <- cbind(1/(1:5), sqrt(1:5)) d <- dist(mm) d 1 2 3 4 2 0.6492864

Re: [R] Sampling the Distance Matrix

2015-09-23 Thread David L Carlson
-Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of William Dunlap Sent: Wednesday, September 23, 2015 3:23 PM To: Lorenzo Isella Cc: r-help@r-project.org Subject: Re: [R] Sampling the Distance Matrix > mm <- cbind(1/(1:5), sqrt(1:5)) > d <- dist

Re: [R] Sampling the Distance Matrix

2015-09-23 Thread William Dunlap
> mm <- cbind(1/(1:5), sqrt(1:5)) > d <- dist(mm) > d 1 2 3 4 2 0.6492864 3 0.9901226 0.3588848 4 1.250 0.6369033 0.2806086 5 1.4723668 0.8748970 0.5213550 0.2413050 > which(as.matrix(d)>0.9, arr.ind=TRUE) row col 3 3 1 4 4 1 5 5 1 1 1 3 1 1

[R] Sampling the Distance Matrix

2015-09-23 Thread Lorenzo Isella
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