Re: [R] R cycle to calculate distances

2008-11-18 Thread P.Branco
It Works now. Thanks to all. P.Branco Gavin Simpson wrote: > > On Mon, 2008-11-17 at 07:20 -0800, P.Branco wrote: >> Sorry, it does not work. >> >> If I do a rnorm I lose the original values of my vectors, and the >> equation >> result must be attained by the use of the original values. >

Re: [R] R cycle to calculate distances

2008-11-17 Thread Gavin Simpson
On Mon, 2008-11-17 at 07:20 -0800, P.Branco wrote: > Sorry, it does not work. > > If I do a rnorm I lose the original values of my vectors, and the equation > result must be attained by the use of the original values. Dimitris was generating some dummy data to test that the function worked. He ha

Re: [R] R cycle to calculate distances

2008-11-17 Thread Philipp Pagel
On Mon, Nov 17, 2008 at 07:20:22AM -0800, P.Branco wrote: > > Sorry, it does not work. > > If I do a rnorm I lose the original values of my vectors, and the equation > result must be attained by the use of the original values. He didn't want you to actually do the rnorm part - he just used that

Re: [R] R cycle to calculate distances

2008-11-17 Thread P.Branco
Sorry, it does not work. If I do a rnorm I lose the original values of my vectors, and the equation result must be attained by the use of the original values. Thanks, P.Branco Dimitris Rizopoulos-4 wrote: > > try this (presented only for two pairs): > > r1 <- rnorm(49) > r2 <- rnorm(49) > s1

Re: [R] R cycle to calculate distances

2008-11-17 Thread Dimitris Rizopoulos
try this (presented only for two pairs): r1 <- rnorm(49) r2 <- rnorm(49) s1 <- rnorm(300) s2 <- rnorm(300) dd <- sqrt(0.723523 * outer(r1, s1, "-")^2 + 0.215518 * outer(r2, s2, "-")^2) dd I hope it helps. Best, Dimitris P.Branco wrote: Dear all, I am for the first time trying to work with

[R] R cycle to calculate distances

2008-11-17 Thread P.Branco
Dear all, I am for the first time trying to work with R, but I have bumped into a problem. I have four vectors: r1 (49 values) r21 (49 values) r22 (49 values) r3 (49 values) s1 (300 values) s21 (300 values) s22 (300 values) s3 (300 values) And I would like to calculate the distances from all re