Re: [R] distance matrix

From: WCD <vydramail_at_quick.cz>
Date: Sun, 20 Jan 2008 13:27:02 -0800 (PST)

Wow, thank you all for advice, I'll have to get more familiar with R. The dist() fuction is probably the right way. Filip Kral.

Erin Hodgess-2 wrote:
>
> Suppose you have:
>

>> x <- runif(25)
>> y <- rnorm(25)
>> x.df <- data.frame(x,y)
>> dist(x.df)

>
>
> The default is euclidean distance.
>
> Hope this helps!
>
> Sincerely,
> Erin
>
>
> On Jan 20, 2008 2:41 PM, WCD <vydramail_at_quick.cz> wrote:
>>
>> Hello, I want do get the point to point distance matrix.
>> Suppose, I have a data frame where the first column is X and second
>> column
>> is Y coordinate of points.
>> I define a function dst(x1,y1,x2,y2) to claculate distance between two
>> points. But I don't know how to tell R to calculate dst for every two
>> points
>> and create a matrix of these distances.
>>
>> Can you give me a little guidance, please? I am quite new to R and
>> programming.
>> Thanks for every advice. Filip Kral.
>>
>> --
>> View this message in context:
>> http://www.nabble.com/distance-matrix-tp14986595p14986595.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help_at_r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>

>
>
>
> --
> Erin Hodgess
> Associate Professor
> Department of Computer and Mathematical Sciences
> University of Houston - Downtown
> mailto: erinm.hodgess_at_gmail.com
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>
-- 
View this message in context: http://www.nabble.com/distance-matrix-tp14986595p14987085.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Received on Sun 20 Jan 2008 - 21:31:32 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 20 Jan 2008 - 22:30:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive