[R] help me understand how things work.

2010-09-16 Thread Alaios
Hello I have some strange output from R and I try to understand how R works. Could you please help me with that? temp - rbind (c(10,1),c(99,98)) temp [,1] [,2] [1,] 101 [2,] 99 98 dist(temp) 1 2 131.6435 sqrt(dist(temp)) 1 2 11.47360 so far so good.

Re: [R] help me understand how things work.

2010-09-16 Thread Michael Bedward
Hello Alex, Look at the help page for the dist function. You'll see it doesn't return a simple vector or matrix, rather a dist class object which is why you got a surprise when you tried to treat it like a simple value. The function is not really intended for spatial point distance calculations,

Re: [R] help me understand how things work.

2010-09-16 Thread Julian Burgos
Hi Alex, What is happening is that the ´dist´function calculates a distance matrix, and returns an object of the ´dist´ class. temp - rbind (c(10,1),c(99,98)) x=dist(temp) x 1 2 131.6435 class(x) [1] dist You can see a description of the ´dist´class at the end of the function´s

Re: [R] help me understand how things work.

2010-09-16 Thread Alaios
, September 16, 2010 1:28:31 PM Subject: Re: [R] help me understand how things work. ?dist BTW, to me this does not happens. x - matrix(rnorm(100), nrow=5) d - dist(x) 1/sqrt(d) 1/sqrt(dist(x)) Hope it helps mario On 16-Sep-10 12:02, Alaios wrote: Hello I have some

Re: [R] help me understand how things work.

2010-09-16 Thread Mario Valle
*From:* Mario Valle mva...@cscs.ch *To:* Alaios ala...@yahoo.com *Sent:* Thu, September 16, 2010 1:28:31 PM *Subject:* Re: [R] help me understand how things work. ?dist BTW, to me this does not happens. x - matrix(rnorm(100), nrow=5) d - dist(x) 1/sqrt(d) 1/sqrt(dist(x)) Hope it helps